On Wednesday 10 April 2002 23:54, Jennifer Downey wrote:
> Hi all,
>
> I had to  re-write this so it would at least show something on the page.
>
> $query = "SELECT id, name, image, quantity FROM
> {$config["prefix"]}_my_items WHERE uid={$session["uid"]} ORDER BY id";
> $ret = mysql_query($query);
> $row = mysql_fetch_array($ret);

Gets the first record

> $id = $row['id'];
> $image = $row['image'];
> $name = $row['name'];
> $quantity = $row['quantity'];
>
>
>
> $display_block .="<img src=$image><br>$name<BR>$quantity";
> echo "$display_block";
>
>
> I know there are 2 records in the table but it will only display the first.
> What have I done wrong?

You've only asked for the first row and that's what you got.

Use a while loop to get all records:

...
$ret = mysql_query($query);
while ($row = mysql_fetch_array($ret)) {
  do something or another;
}

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
I'm all for computer dating, but I wouldn't want one to marry my sister.
*/

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

Reply via email to