Question

Possible Duplicate:
mysql_fetch_array return only one row

Let's say I use mysql_fetch_assoc, to filter things like:

mysql_fetch_assoc(mysql_query("SELECT * from tickets WHERE issuer = '" . $name . "'"));

I usually just use a for loop to loop between tickets by using ticketid column (auto increamenting) however, when I use this one, I might have ticketid 1 and then ticketid 4, since I'm filtering it by the issuer. Any way to get the ticketid of the next result or just get the fetched value of it?

Was it helpful?

Solution

mysql_query return an resource, you should using mysql_fetch_assoc each it, so try this:

$result = mysql_query("SELECT * from tickets WHERE issuer = '" . $name . "'");
while($row = mysql_fetch_assoc($result)) {
    print_r($row);
}

And more mysql_query

Maybe you can try PHP Data Objects (PDO)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top