Page 1 of 1

Basic database help

Posted: Mon Jul 21, 2003 12:03 pm
by maxn
I want to display 3 boxes on my homepage, each containing different text, which will be updated frequently by me and other admin guys.

I think the best way to do this is to have the boxes simply display a particular field or cell or something from a particular database (or text file?), and periodically update that field/cell/something.

Does this sound like a job for PHP? How would I do this, or how is a better way to accomplish this?

I use iMac and GoLive. Host company has PHP and mysql on server.

Any help greatly appreciated.

Posted: Mon Jul 21, 2003 12:56 pm
by evilmonkey
That's not too hard:

Code: Select all

$sql="SELECT yourtext FROM yourtable WHERE whateveryouwant";
$result=mysql_query($sql, $connection);
$row=mysql_fetch_assoc($result);
//format your HTML into a table or a box and in there put
echo $row['yourtext'];

Posted: Mon Jul 21, 2003 12:59 pm
by maxn
Thanks for the coding. I wish I were a little more sophisticated w/ PHP so I knew what to do with it. I'll have to educate myself a bit.