"mysql_fetch_row" wrong on mysql 3.23.52
Dear my friends.... I am trying to read the content per line of a query result with "mysql_fetch_row". But I got this error message : " Musingin homepage koneksi sukses. Sukses memilih database. Sukses melakukan query. Besar hasil query 1. Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /srv/www/htdocs/i-am-e-system/cgi-bin/tulis.php on line 20 Akhir baris. " Could any body tell me where my mistake? Here is my codes under belom: <?PHP $konek=mysql_connect("localhost", "prabu", "password"); if ($konek){ echo "koneksi sukses.\n"; mysql_select_db("berita"); echo "Sukses memilih database.\n"; $kalimatsql=" SELECT noberita, pengirim, tanggal, namafile FROM berita "; $hasil = mysql_query($kalimatsql, $konek); echo "Sukses melakukan query.\n"; $besarhasil=sizeof($hasil); echo "Besar hasil query $besarhasil.\n"; while ($baris = mysql_fetch_row($hasil)){ list($noberita,$pengirim,$tanggal,$namafile)=$baris; echo " Nomer berita : $noberita\n Pengirim : $pengirim\n Tanggal : $tanggal\n Nama file : $namafile\n "; } echo "Akhir baris.\n"; } else echo "Gagal konek.\n"; mysql_close($konek); ?> Thank you very much in advance. __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in
Your code contains no error checking. You check that your connection is made, but you don't check that the database selection worked, or that the mysql_query() call worked correctly. I'm not sure what that sizeof() call is supposed to do, but it's not telling you anything interesting! Put the error checking in and try again. At a quick glance your code looks basically right, so I suspect you're interacting with your DB incorrectly. -- "...our desktop is falling behind stability-wise and feature wise to KDE ...when I went to Mexico in December to the facility where we launched gnome, they had all switched to KDE3." - Miguel de Icaza, March 2003
It is solved. Thank you very much, my friend... --- Derek Fountain <derekfountain@yahoo.co.uk> wrote:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in
Your code contains no error checking. You check that your connection is made, but you don't check that the database selection worked, or that the mysql_query() call worked correctly. I'm not sure what that sizeof() call is supposed to do, but it's not telling you anything interesting!
Put the error checking in and try again. At a quick glance your code looks basically right, so I suspect you're interacting with your DB incorrectly.
-- "...our desktop is falling behind stability-wise and feature wise to KDE ...when I went to Mexico in December to the facility where we launched gnome, they had all switched to KDE3." - Miguel de Icaza, March 2003
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists/archive/suse-programming-e
__________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com
participants (2)
-
Derek Fountain
-
Prabu Subroto