Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in

Posted by alundra00 on Stack Overflow See other posts from Stack Overflow or by alundra00
Published on 2012-10-06T09:35:28Z Indexed on 2012/10/06 9:37 UTC
Read the original article Hit count: 129

Filed under:

hi i am new to php and now i having problem with login

  1. Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...
  2. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in....

coding php:

 <?php
include ("config/koneksi.php");
include ("config/library.php");
$pass = md5($_POST['password']);

$login = mysql_query("SELECT * FROM user WHERE id_user='$_POST[username]' AND sesi='$pass'");
$found = mysql_num_rows($login);  //error
$r = mysql_fetch_array($login);   //error

if ($r){
  session_start();
  session_register("username");
  session_register("sesi");
  session_register("role");

  $_SESSION[username] = $r[id_user];
  $_SESSION[sesi] = $r[sesi];
  $_SESSION[role]= $r[role];
  header ('location:home.php');
}

© Stack Overflow or respective owner

Related posts about php