0
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

if(isset($username)){

    $queryIsUsername = ("SELECT count(user) FROM users WHERE user = '$username'");
    $actionQueryIsUsername = mysql_query($queryIsUsername);
    while($rowIsUsername = mysql_fetch_array($actionQueryIsUsername)) {
        $isUsername[] = $rowIsUsername['COUNT(user)'];
    }

    if($isUsername[0]="0"){

        header("Location: login.php?error=e1");
    }

I have checked the MySQL database, it is online. I have checked the query it does work. I'm not sure whats going on, i've done this a lot. The error is as follows.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/craftlist/index.php on line 12

Ozair Patel
  • 1,338
  • 1
  • 10
  • 17

2 Answers2

0

Make sure

  • You're selecting the database
  • You're selecting the right column name
  • You have single quotes where needed.
Ryan
  • 390
  • 1
  • 3
  • 15
0

When you are getting errors like this:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/craftlist/index.php on line 12

then that means you have an error in your mysql_query. To see what the real error is use:

mysql_query() or die(mysql_error());
alexander7567
  • 659
  • 13
  • 30