crave_kevin Posted March 12, 2011 Share Posted March 12, 2011 don't know what to do next with this error popping up,,,any help? <?php //set up the variables $loguser = $_POST['loguser']; $logpass = md5($_POST['logpass']); $login = $_get['login']; //connect with the server and the database mysql_connect("localhost","root","") or die("Can't connect with the Server!"); mysql_select_db("comp3project") or die("Can't connect with the database!"); if($login="yes") { $get = mysql_query("SELECT count(cid) FROM customer_data WHERE username = '$loguser' and password = '$logpass'"); $result = mysql_result($get,0); if($result!=1){print "Login Failed!";} else {print "Login Successful!";} } ?> Quote Link to comment https://forums.phpfreaks.com/topic/230407-warning-mysql_result-expects-parameter-1-to-be-resource-boolean-given-in-d/ Share on other sites More sharing options...
cs.punk Posted March 12, 2011 Share Posted March 12, 2011 Your query fails as far as I can tell. Try adding this after the query: echo "Mysql Error: " . mysql_error(); Quote Link to comment https://forums.phpfreaks.com/topic/230407-warning-mysql_result-expects-parameter-1-to-be-resource-boolean-given-in-d/#findComment-1186548 Share on other sites More sharing options...
denno020 Posted March 12, 2011 Share Posted March 12, 2011 I don't think you need to put those quotes around the variables inside the query. You've enclosed your query in double quotes already, which means you can put variable names straight in there and it'll still work.. Try removing the single quotes around $loguser and $logpass. Denno Quote Link to comment https://forums.phpfreaks.com/topic/230407-warning-mysql_result-expects-parameter-1-to-be-resource-boolean-given-in-d/#findComment-1186561 Share on other sites More sharing options...
Pikachu2000 Posted March 12, 2011 Share Posted March 12, 2011 Any string value in a query string needs to be quoted regardless of whether it's stored in a variable. Quote Link to comment https://forums.phpfreaks.com/topic/230407-warning-mysql_result-expects-parameter-1-to-be-resource-boolean-given-in-d/#findComment-1186612 Share on other sites More sharing options...
cs.punk Posted March 12, 2011 Share Posted March 12, 2011 Also noticed this: $login = $_get['login']; It should be $_GET['login'] Quote Link to comment https://forums.phpfreaks.com/topic/230407-warning-mysql_result-expects-parameter-1-to-be-resource-boolean-given-in-d/#findComment-1186729 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.