murdocsvan Posted July 2, 2010 Share Posted July 2, 2010 $id = $_GET['id']; $query = "SELECT * FROM $tbl_name WHERE site_id='$id'"; Think there might be something wrong with my SQL statement as i get the following error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/206486-mysql_query-supplied-argument-is-not-a-valid-mysql-link/ Share on other sites More sharing options...
marcus Posted July 2, 2010 Share Posted July 2, 2010 $id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM `".$tbl_name."` WHERE `site_id`='".$id."'"; $res = mysql_query($query) or die(mysql_error()); // then do your mysql_fetch_assoc, array, etc Quote Link to comment https://forums.phpfreaks.com/topic/206486-mysql_query-supplied-argument-is-not-a-valid-mysql-link/#findComment-1080119 Share on other sites More sharing options...
PFMaBiSmAd Posted July 2, 2010 Share Posted July 2, 2010 Read the error message. In your mysql_query() statement, the (2nd) parameter that is supposed to be a mysql connection link resource, is not one. Quote Link to comment https://forums.phpfreaks.com/topic/206486-mysql_query-supplied-argument-is-not-a-valid-mysql-link/#findComment-1080120 Share on other sites More sharing options...
murdocsvan Posted July 2, 2010 Author Share Posted July 2, 2010 Sorry, my code actually worked fine. The only problem was i forgot to upload the connection include *FACEPALM*. Thanks anyway guys. Quote Link to comment https://forums.phpfreaks.com/topic/206486-mysql_query-supplied-argument-is-not-a-valid-mysql-link/#findComment-1080128 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.