Jump to content

[SOLVED] mysqli_query() expects parameter 1 to be mysqli ?


Solarpitch

Recommended Posts

Hi Guys,

 

I have the following code that executes when someone has entered there email into the form . . although $email is set, it seems to execute the code but with the error "Warning: mysqli_query() expects parameter 1 to be mysqli, null given in m line 141"

 

I dont know why because $email has been set to a valid address.

 

 

if($email != "")

{

 

$mysql_connect = new mysqli("xxx", "xxx", "xxx");

$mysql_connect->select_db('xxx');

 

$query = "select * from members where

              email = '$email'";

 

    $result = mysqli_query( $mysql, $query ); ****LINE 141****

 

 

    if(!$result)

    {

      echo 'Cannot run query.';

      exit;

    }

 

$count = mysqli_num_rows($result);

 

if ( $count > 0 ){

 

$email_in_use = "Email address already exists.";

$execute = "no";

}

 

else {

echo "Email not found";

}

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.