princess Posted December 29, 2002 Share Posted December 29, 2002 hey another question from me.. still working on the guestbook thing, but started over with a new one, problems i dont understand came on my way.. please can you look at this and explain the mistake to me? i really dont see whats wrong. This is the warning i receive while i test it: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:FoxServwwwtestguestbookindex.php on line 19 this is my code: <? $db = mysql_connect(\"lxxx\",\"xxx\",\"xxx\"); mysql_select_db (\"testgastenboek\", $db); $sql = \'SELECT * FROM `testgastenboek`;\'; $result = mysql_query($sql,$db); while ( $myrow = mysql_fetch_array($result) ) { echo \"<b>Name:</b>\";echo \"<br>\"; echo $myrow[name]; echo \"<br>\"; echo \"<b> Email:</b>\"; echo \"<br>\"; echo \"<a href=\"mailto:\"; echo $myrow; echo \"\">\"; echo $myrow; echo \"</a>\"; echo \"<br>\"; echo \"<b> Homepage:</b>\"; echo \"<br>\"; echo \"<a href=\"\"; echo $myrow; echo \"\">\"; echo $myrow; echo \"</a>\"; echo \"<br>\"; echo \"<b>Comment:</b>\"; echo \"<br>\"; echo $myrow[comment]; echo \"<br>\"; echo \"<br>\"; echo \"<a href=changeform.php?id=$myrow[id]>[change]</a>\"; echo \" \"; echo \"<a href=changeform.php?id=$myrow[id]>[delete]</a>\"; echo \"<hr noshadow width=\"300\" align=\"left\" color=\"#FF6600\">\"; } ?> i hope this is enough information.. thanks in advance, Princess Quote Link to comment https://forums.phpfreaks.com/topic/13-mysql_fetch_array-supplied-argument-is-not-a-valid/ Share on other sites More sharing options...
effigy Posted December 31, 2002 Share Posted December 31, 2002 the error means that the query never executed, therefore it has nothing to be identified with. this means there is a problem with any of these: (a) the database connection; (B) choosing a database; © running the query i think this extra \';\' here is the problem: $sql = \'SELECT * FROM `testgastenboek`;\'; semicolons are not needed to end a query when using php, opposed to the mysql command line. Quote Link to comment https://forums.phpfreaks.com/topic/13-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-26 Share on other sites More sharing options...
delamitri Posted January 8, 2003 Share Posted January 8, 2003 easiest way, and i guess that the last poster is right print mysql_error(); after the query call. Kevin Quote Link to comment https://forums.phpfreaks.com/topic/13-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-70 Share on other sites More sharing options...
munnabd_02 Posted December 6, 2006 Share Posted December 6, 2006 [email protected] here my data show 'tt' but other server side not work Why ? Please solve and mail me: [email protected] <?php //if you view 'tt' mail me([email protected]) $cnn=mysql_connect('db1.awardspace.com', 'progli_progli', '8013731') or die ("Cannot connect to MySQL server: " . mysql_error()); mysql_select_db('progli_progli') or die ("Cannot connect to db: " . mysql_error()); $result=mysql_query("select *from user"); $row=mysql_fetch_row($result); echo $row[1]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/13-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-136151 Share on other sites More sharing options...
artacus Posted December 6, 2006 Share Posted December 6, 2006 Change $result=mysql_query("select *from user"); to $result=mysql_query("select *from user") or die(mysql_error() . "<br>$query"); and "select *from" to "select * from" Quote Link to comment https://forums.phpfreaks.com/topic/13-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-136409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.