corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP/HTML » Post Reply

Post Reply
Who Can Post? All users can post new topics and all users can reply.
Icon:
Formatting Mode:
Normal
Advanced
Help

Insert Bold text Insert Italicized text Insert Underlined text Insert Centered text Insert a Hyperlink Insert Email Hyperlink Insert an Image Insert Code Formatted text Insert Quoted text
Message:
HTML is Off
Smilies are On
BB Code is On
[img] Code is On
Post Options: Disable smileys?
Turn BBCode off?
Receive email notification of new replies?

liamC

posted on 24th Jan 07 at 17:32

yay! Thanks very much for your help mate - much appreciated!!!


James

posted on 24th Jan 07 at 17:26

You can apply any HTML styles to it just as you would anything else by echo-ing out the HTML


James

posted on 24th Jan 07 at 17:24

Bold - Put echo "<b>"; before the text and echo "</b>"; after


James

posted on 24th Jan 07 at 17:21

oops might need the <br /> in speech marks.

havent done PHP for ages.

[Edited on 24-01-2007 by James]


James

posted on 24th Jan 07 at 17:21

echo <br />;


liamC

posted on 24th Jan 07 at 17:20

I love you James :D

One last thing though...(for now!).

The 2 rows which are being echoed, I want a line space between them.

Putting a <br /> inbetween them doesn't work as it is obviously disrupting the PHP code.

Also, I would like the row in bold!!

Any ideas?

[Edited on 24-01-2007 by liamC]


James

posted on 24th Jan 07 at 17:13

I would set a flag, say call the field "AdvertId" or something. Give it 1, 2, 3, 4 etc and then put "Where AdvertId = 3" etc on the end of the select.


liamC

posted on 24th Jan 07 at 17:12

OK...another one.

I have made a table wit 2 fields (Title field and description field) so it is echoing 2 rows;

code:
echo $myrow["title"];
echo $myrow["desc"];


Each field has 4 rows.

How would I get the PHP to only select the top row, or the third row etc?

[Edited on 24-01-2007 by liamC]


liamC

posted on 24th Jan 07 at 16:51

Nevermind, sorted it! :D

For future reference, in this line of code taken from my above post;

code:
$result = mysql_query("SELECT databasetable FROM databasename",$db);


change it to

code:
$result = mysql_query("SELECT * FROM tablename",$db);


Cheers for your help James/aPk for the help. Wasn't so hard at all :)


liamC

posted on 24th Jan 07 at 16:45

OK, getting there eventually.

code:
<?php
$db = mysql_connect("mysqlname.domain.com", "username", "password");
mysql_select_db("databasename",$db);
$result = mysql_query("SELECT databasetable FROM databasename",$db);
while($myrow = mysql_fetch_array($result))
{
echo $myrow["rowname"];
}
?>


I get the following error:

code:
php:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.saggy/user/domain.com/folder/index.php on line 61
?>


Any ideas where I'm going wrong?

[Edited on 24-01-2007 by liamC]


liamC

posted on 24th Jan 07 at 15:47

Cheers.

Anyone able to help me out with the code for this?

I am a php n00b. :(


AndyKent

posted on 24th Jan 07 at 15:26

just SELECT the text out of the database (into a $var) and then echo it out again - simple...

[Edited on 24-01-2007 by aPk]


liamC

posted on 24th Jan 07 at 15:21

Is this hard to do mate?

I can write text to the database no problem, and can set that up easy, but it would be displaying the text that I would have a problem with, as I've never done this before? Any pointers/tips? Does it take much programming?


James

posted on 24th Jan 07 at 15:18

Store the text of each one in a database.

Read it out on the homepage and create an admin screen that chages it in the DB


liamC

posted on 24th Jan 07 at 15:17

Right...just a thought/idea if anyone has any how to do this, or if it is possible.

Got a homepage (PHP) with 4 boxes on it. Each box has special offer text in it.

It would be ideal if via an admin page of some sort, that staff were able to type into a box what text they wanted in each special offer box and it then updates the homepage with the text they've just typed in.

Is this possible. Anyone have anymore info on this feature/function?

Cheers