|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
supplied argument is not a valid mysql result resource, help I have written a code running which returns with an error "supplied argument is not a valid mysql result resource" for: Code: <?php while($row = mysql_fetch_array($result)) { ?>
__________________ Don't talk unless you can improve the silence. |
#2
| |||
| |||
Re: supplied argument is not a valid mysql result resource, help Your SQL query is failing. Use the or die mysql_error();. This will display the problem. Code: <? $sql = "SELECT * FROM `mytable` WHERE `id` = '1'"; db_connect();//connecting mysql db function i wrote $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ // do some thing here } mysql_close(db_connect()); ?>
__________________ Education, Career and Job Discussions |
#3
| |||
| |||
Re: supplied argument is not a valid mysql result resource, help This error message indicates that an error occurred in the call to mysql_query, which is indicated by a return of FALSE. FALSE is not a valid resource identifier, and so you get the error shown. When mysql_query returns FALSE, you should echo the error message indicated by mysql_error() to find out what the real error was. |
#4
| |||
| |||
Re: supplied argument is not a valid mysql result resource, help It is possible that the query failed, or that you failed to connect to the database server. Checking for these potential problems and gracefully handling them should be the way to go. Incidentally, use mysql_num_rows() not mysql_numrows() as the latter is deprecated. Using "values" as a table name could create problems since values is a mysql keyword. Try changing the table name and see if it starts working. |
![]() |
|
Tags: argument, mysql |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to calculate cost based on resource rate? I have more than 5 rates per resource | boxta | Microsoft Project | 8 | 08-05-2012 12:46 PM |
The Search Result in Outlook 2007 does not show current years result | Shika | Windows Software | 4 | 24-04-2012 07:53 AM |
How to match MySQL result from keywords? | Utpalini | Windows Software | 5 | 30-08-2011 09:28 AM |
Mysql Error : Can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2 | roshan45 | Software Development | 3 | 07-11-2009 09:36 PM |
How to combine 3 result rows in mysql | HAKAN | Software Development | 3 | 20-05-2009 10:54 PM |