|
Posted by Jon on 01/10/06 00:33
Display them via HTML on a php page you mean?
If you just want to display each row, you'd use something like this - When
you say 'one field in each row gets a variable' I'm not sure what you mean
there - I'll include code that I would likely use if I wanted to assign a
variable for ONE field for each record - it'd go into an array for me
personally. This code also isn't exact, just typed on the fly -
$i = 0; //counter for array
//setup and run the query
$sql = "SELECT * FROM table_name";
$queryResult = mysql_query($sql);
//cycle through the query to get the rows outputted and data setup
while($row = mysql_fetch_array($queryResult)){
//echo for each field you want to display from each row
echo $row['fieldName1'].$row['fieldName2];
//Assign a field to an array
$array[$i] = $row['fieldName1];
$i++; //increment $i to move to the next index in the array when the
loop runs again. $i should be equal to the number of records at the end
}//end while
That help or am I not understanindg the question?
"ameshkin" <amir.meshkin@gmail.com> wrote in message
news:1136845201.967334.289610@g49g2000cwa.googlegroups.com...
>I know this is probably not too hard to do, but how do I display
> multiple rows of a mysql query/recordset. Im having trouble doing
> this. I don't just want to display them, but I want to make sure ONE
> field in each row gets a variable.
>
> This is probably something simple that is more experienced, but I've
> only been doing this for a couple of months. Any help would be
> appreicated.
>
> Thank You
>
Navigation:
[Reply to this message]
|