Automacticly updating page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
imthunder
Forum Newbie
Posts: 2
Joined: Mon Jun 13, 2005 4:19 am

Automacticly updating page

Post 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
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
imthunder
Forum Newbie
Posts: 2
Joined: Mon Jun 13, 2005 4:19 am

Post by imthunder »

sorry but i don't really understand, can someone define the array for me???
thanx
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post 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.
Post Reply