(sorry if this shows up twice!)

hi, i'm new to php and am having a problem with a script i'm working on.
i posted this to alt.php a few days ago and got part of my problem
fixed, but i still have one problem which i can't figure out and haven't
gotten an answer to there.

here is the code:

<?PHP
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("photo",$db);
print ("<table width=100%>");
//this is the little counter....
$tablei = 0;
//CONNECT TO DATABASE
$result = mysql_query("select photos.filetype, photos.bin_data,
photos.id_files, information.id, information.desc, photos.fulldesc from
photos, information order by information.id DESC",$db);
if ($row = mysql_fetch_array($result)) {
do {

// Produce the column for each record....
print ("<td width=25% align=center valign=top><table  width=100%
border=0 cellspacing=2 cellpadding=2><tr><td>image will go
here</td></tr><tr><td >(this is id number):
".$row[id]."</td></tr><tr><td>(this is description):
".$row[fulldesc]."</td></tr></table></td>");

$tablei = $tablei + 1;

    if ($tablei == "4")  {
                         print ("</tr> <tr>");
                         $tablei = '0';
                        }
} while($row = mysql_fetch_array($result));
} else {print ("No Records");}

?>

an example of the output can be found here:
http://www.thosenetworkguys.com/test.php

the problem i am having is that the php code is printing each record in
the database multiple times.  the number of times the record is printed
is equal to the number of records i have in the database.  if you look
at the url above, you'll see what i'm getting at.  for instance, i now
have 5 records in the database and for some reason each individual
record is being inserted into the page 5 times now.

the code above was suggested as i was trying to create a page that would
print an html table and start a new row at four columns.  i assume the
problem i am having now has something to do with the math going on in
the script to format the html table, but i have tried numerous changes
to the value and keep getting the same thing.

could someone be kind enough to help out a php newbie and help me figure
out how to fix this?  i just can't figure it out.

thanks.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to