Adhe_Arie15 Posted November 7, 2013 Share Posted November 7, 2013 Hello everyone! I'm new in this forum.I'm having a problem with my coding : when I execute the code below >> $cek_login=mysql_num_rows($login);if (empty($cek_login)){echo "";echo "";}else{//daftarkan ID jika user dan password BENARwhile ($row=mysql_fetch_array($login)){//$id=$row[0];//session_register('id');//CHANGE 1://---------$_SESSION["id"] = $row[0];}echo "";echo "";}?>' target='_blank'>session_start();session_destroy();include "koneksi.php";$login=mysql_query("SELECT * FROM admin WHERE username='$_POST[username]' AND password='$_POST[password]'");$cek_login=mysql_num_rows($login);if (empty($cek_login)){echo "";echo "";}else{//daftarkan ID jika user dan password BENARwhile ($row=mysql_fetch_array($login)){//$id=$row[0];//session_register('id');//CHANGE 1://---------$_SESSION["id"] = $row[0];}echo "";echo "";}?> After that this error come out : warning:mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\project\cek_login.php on line 7 Quote Link to comment Share on other sites More sharing options...
dalecosp Posted November 7, 2013 Share Posted November 7, 2013 After that this error come out : warning:mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\project\cek_login.php on line 7 This means that $login is not a valid database resource, your query on line one isn't returning anything. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted November 7, 2013 Share Posted November 7, 2013 Did you try using mysql_error() to see if the query results in an error? http://php.net/manual/en/function.mysql-error.php Quote Link to comment 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.