Page 1 of 1

Automacticly updating page

Posted: Mon Jun 13, 2005 4:24 am
by imthunder
Hi,
i have made a page where users can add to my database the title,rating and review of any gae they choose. can someoone please explain how, in PHP code, i can display this info on a page suitably, without having to draw up a table in html everytime someone adds to the list of reviews.

Sort of like a guestbook i think.
Thanx in advance

IAT

Posted: Mon Jun 13, 2005 4:32 am
by malcolmboston
example

Code: Select all

// you have the variable $array from previous SQL select
// im assuming array starts with [1] and not [0] (personal preference)
$count = count($array);
if ($count >= 1)
{
   // we have a result we can auto print <table
   print "<table width=\"500\">";
   for ($i = 1; $i <= $count; $i++)
   {
     print "<tr>";
     print "<td>{$array[$i][item]}</td>";
     print "</tr>";
   }
   // close after the loop
   print "</table>";
}
i should think this is the standard way most people do it

Posted: Mon Jun 13, 2005 6:38 am
by imthunder
sorry but i don't really understand, can someone define the array for me???
thanx

Posted: Mon Jun 13, 2005 6:44 am
by phpScott
can you get the review info out of the db?

if so just assing the result set to $array and use malcomboston's example to get you going.