Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Mark Sargent wrote: *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36* Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { mysql_query() returns false on failure, and false isn't a valid MySQL result resource. A quick and dirty way to alert yourself to the problem is to change line 22 to this: $result = mysql_query('SELECT product_name, product_model_number, product_serial_number FROM Products', $db) or exit(mysql_error()); Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Drewcore wrote: just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi All, ok, that fixed the error message, thanx, but, no data is being displayed, only the table/row/cells. Database table, Products definitely has at least 1 entry in it. Cheers. Mark Sargent. printf(trtd%s %s/tdtd%s/tdtd%s/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Hi all, ever tried to test if your connection to the database succeeded? maybe that's why it shouted that ...not a valid result resource... msg. Balazs Hegedus Mark Sargent wrote: Drewcore wrote: just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi All, ok, that fixed the error message, thanx, but, no data is being displayed, only the table/row/cells. Database table, Products definitely has at least 1 entry in it. Cheers. Mark Sargent. printf(trtd%s %s/tdtd%s/tdtd%s/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Hi again, just another tip...it's from the php man: *manmysql_query()* will also fail and return *FALSE* if the user does not have permission to access the table(s) referenced by the query./man Balazs Hegedus Mark Sargent wrote: Drewcore wrote: just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi All, ok, that fixed the error message, thanx, but, no data is being displayed, only the table/row/cells. Database table, Products definitely has at least 1 entry in it. Cheers. Mark Sargent. printf(trtd%s %s/tdtd%s/tdtd%s/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Hegeds Balzs wrote: Hi all, ever tried to test if your connection to the database succeeded? maybe that's why it shouted that ...not a valid result resource... msg. Balazs Hegedus Mark Sargent wrote: Drewcore wrote: just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi All, ok, that fixed the error message, thanx, but, no data is being displayed, only the table/row/cells. Database table, Products definitely has at least 1 entry in it. Cheers. Mark Sargent. printf(trtd%s %s/tdtd%s/tdtd%s/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); Hi All, yes, succeeded in connecting to the database earlier, with the below code, html body ?php $db = mysql_connect(localhost, root, pwd omitted); mysql_select_db(status,$db); $result = mysql_query(SELECT * FROM Products,$db); printf(Product Name: %sbr\n, mysql_result($result,0,product_name)); printf(Product Price: %sbr\n, mysql_result($result,0,product_price)); printf(Product Serial Number: %sbr\n, mysql_result($result,0,product_serial_number)); printf(Product Model Number: %sbr\n, mysql_result($result,0,product_model_number)); ? /body /html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
I rarely use the @ sign. It is what I call 'balistic programming'. You know, a shell, once it leaves the cannon, is not controlled in any way, you just hope it will get where you want to go. Instead you should check for errors and recover from them as gracefully as possible.. You will see in a lot of examples in the PHP manual that most database operations are followed by the following code segment: SQL operation or die('your own text to help you locate the error' . mysql_error()); This will help you locate and know which is the error. In your case, the mysql_query function has had an error and has returned FALSE instead of a resource handle. FALSE, being an invalid argument to Fetch. The error is not really where it pops, but has happened before, either at the Query or even before, when you openned the database. Either of those statements followed by propper error detection would tell you all you need to know to fix it. But don't just ignore the error, the @ sign should be used sparingly, if at all. Satyam Drewcore [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Mark Sargent wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 This means that $result is not a valid result resource. You can var_dump($result) to see that this is true. It probably contains false. You get false when there's a problem with your query. If you echo mysql_error() after the query, you will get more information about what is wrong. Janet * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.....\none.php on line 286
Hi Thomas and All, why are you using sql_query through your code? its mysql_query for mysql! I use phpnuke and it have a sql_layer.php. You are correct, for mysql is mysql_query. But this dont is the problem, I change it and the problem continue! Any tip?? Thanks Marcelo - Original Message - From: Thomas Seifert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 08, 2003 6:50 PM Subject: Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.\none.php on line 286 why are you using sql_query through your code? its mysql_query for mysql! and the result, needed for mysql_fetch_row is returned from that function. read the docs again. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.....\none.php on line 286
Hi Janet, I dont have know how in php. I inserted the function mysql_error() in my code and it dont return any message! Thanks Marcelo This means that when you did: $result = mysql_query($sql); $result did not end up with a valid resource in it. Then, when you do the fetch row command using $result, it fails with this message. In general, the reason in that there is something wrong with the query so it either fails or doesn't return any results. You can use mysql_error() to find out what went wrong if it failed. Janet --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.....\none.php on line 286
Hi Philip and Thomas and All. Thanks very much for yours helps. I am Brazillian and I speak in portuguese, for this, I am sorry very much for my bad english. After a long time, my code works very good! But, I dont understand what was the problem! My code was: $result = sql_query(select categoria, nombre, datafim from .$prefix._anuncios order by datafim limit 0,30, $dbi); while (list($categoria, $nombre) = sql_fetch_row($result, $dbi)) { $content .= img src=blocks/images/diamond.gifnbsp;a href=\modules.php?name=Concurso\font color=\#096C88\b$categoria /b $nombre/anbsp;; } and dont works. If I change it for: //$result = sql_query(select categoria, nombre, datafim from .$prefix._anuncios order by datafim limit 0,30, $dbi); $sql = select categoria, nombre, datafim from .$prefix._anuncios order by datafim limit 0,30; while (list($categoria, $nombre) = sql_fetch_row($result, $dbi)) { $content .= img src=blocks/images/diamond.gifnbsp;a href=\modules.php?name=Concurso\font color=\#096C88\b$categoria /b $nombre/anbsp;; } It works very good! My question: In while instruction have a $result and $dbi. They dont are necessary in the sql_query? Understand me? Marcelo --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.....\none.php on line 286
What this message means? What it is the error? Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.\none.php on line 286 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.....\none.php on line 286
What this message means? What it is the error? Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.\none.php on line 42 This is the code. Thanks very much. Marcelo ?php if (eregi(block-Concurso.php, $PHP_SELF)) { Header(Location: index.php); die(); } $usemarquee = 1; $scrolldirection = left; global $prefix, $multilingual, $currentlang, $dbi; $sql = DELETE FROM .$prefix._anuncios WHERE datafimNOW(); sql_query($sql, $dbi); if ($multilingual == 1) { $querylang = WHERE (alanguage='$currentlang' OR alanguage=''); } else { $querylang = ; } $result = SELECT categoria, nombre, datafim FROM .$prefix._anuncios ORDER BY datafim LIMIT 0,30; sql_query($result, $dbi); $content = table width=\100%\ border=\0\; $content .=center STYLE=\text-decoration: none\font color=\#66\bĂltimos 10 Concursos/b/center; $content .= Marquee Behavior=\Scroll\ Direction=\$scrolldirection\ $width=\100%\ ScrollAmount=\3\ ScrollDelay=\90\ onMouseOver=\this.stop()\ onMouseOut=\this.start()\; \\ line 42 while (list($categoria, $nombre, $datafim, $counter) = mysql_fetch_row($result, $dbi)) { $content .= img src=blocks/images/diamond.gifnbsp;a href=\modules.php?name=Concurso\font color=\#096C88\b$categoria br $nombre/b/anbsp;; } $content .= /table; ? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php