SEVIZ Posted May 11, 2009 Share Posted May 11, 2009 Here is my code <?php $con = mysql_connect("--------","------------","-----------"); if (!$con) { die('Could not connect: ' . mysql_error()); } $result = mysql_query("SELECT * FROM sprint WHERE id=7710"); while($row = mysql_fetch_array($result)) { echo $row['num'] . " " . $row['name']; } ?> I get this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /techdb.php on line 10 What am I missing here? Link to comment https://forums.phpfreaks.com/topic/157744-solved-mysql-fetch-array-error/ Share on other sites More sharing options...
gevans Posted May 11, 2009 Share Posted May 11, 2009 You haven't chosen a db; http://uk2.php.net/manual/en/function.mysql-select-db.php Link to comment https://forums.phpfreaks.com/topic/157744-solved-mysql-fetch-array-error/#findComment-832003 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 Or just run the SQL "use dbname" where dbname is the name of the DB. Link to comment https://forums.phpfreaks.com/topic/157744-solved-mysql-fetch-array-error/#findComment-832004 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.