I have this code to get the fields from a table for as long as there are rows in the table:
[php:1:5f84876c54]<?php
$SQL = \" SELECT * FROM $tablename \";
# execute SQL statement
$retid = mysql_query($SQL, $cid);
# check for errors
if (!$retid) { echo(\"ERROR: \" . mysql_error() . \"n$SQLn\"); }
else {
# fill variables
while ($row = mysql_fetch_array($retid)) {
$catname = $row[\"catname\"];
$dogname = $row[\"dogname\"];
$pigname = $row[\"pigname\"];
$horsename = $row[\"horsename\"];
?>[/php:1:5f84876c54]
What I want to do is create and fill up different PHP variables for each row of my table. so I want to have a variable called $catname1 for the cat\'s name in the first row, but also to have a variable called $catname2 for the cat\'s name in the second row, and $catname3, $catname4 etc etc until there\'s no more rows.
Any help greatly appreciated, I have vague ideas about using mysql_fetch_row() to get the row number and append this onto the variable name but am not really sure how.