mysql_num_rows & mysql_fetch_row doesnt agree....

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jolan_lars
Forum Newbie
Posts: 19
Joined: Thu Oct 23, 2003 12:15 pm

mysql_num_rows & mysql_fetch_row doesnt agree....

Post 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:
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
jolan_lars
Forum Newbie
Posts: 19
Joined: Thu Oct 23, 2003 12:15 pm

Post by jolan_lars »

nope....didnt work..

im weak at loops so please troubleshoot it for me... :-(
jolan_lars
Forum Newbie
Posts: 19
Joined: Thu Oct 23, 2003 12:15 pm

Post by jolan_lars »

wait i think i got it already..... the loop, and you was the saver after all...tnx.... :-)
jolan_lars
Forum Newbie
Posts: 19
Joined: Thu Oct 23, 2003 12:15 pm

Post 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....
Post Reply