Page 1 of 1

mysql_num_rows & mysql_fetch_row doesnt agree....

Posted: Thu Oct 23, 2003 12:15 pm
by jolan_lars
i have a query:

$query = "select edition from work_sked where date = '$today' and proofreader = '$user'"

The corect answer should be 2 fields, "Korea" and "Germany".

mysql_num_rows is telling me i got 2 rows affected by the query.

mysql_fetch_row/array is fetching me only the first one.

I need to fetch the two fields, "Korea & "Germany". Am i using the right command or not. If not, what is the right sql command to fetch them all.

Pleaasse help. :cry:

Posted: Thu Oct 23, 2003 12:30 pm
by Nay
Yeah, but you need to use a loop on this. So it should be:

Code: Select all

while($rows = mysql_fetch_array($result)) {
echo $rows['row'];
}
-Nay

Posted: Thu Oct 23, 2003 12:42 pm
by jolan_lars
nope....didnt work..

im weak at loops so please troubleshoot it for me... :-(

Posted: Thu Oct 23, 2003 12:48 pm
by jolan_lars
wait i think i got it already..... the loop, and you was the saver after all...tnx.... :-)

Posted: Thu Oct 23, 2003 12:52 pm
by jolan_lars
ok, i need to put the fields in a variable array and address them numerically.

e.g.

$rows = array(germany, korea, .....);

pls help me to do that....

tnx in advance....