php - mysql query not working gives and error -


hello guys have 2 same querys 1 working , 1 not 1 working fine :

<?php  require 'mysql.php';  if(isset($_post["email"])){     $email = $_post["email"];      $stmt = $connect->prepare("select email users email=? ");     $stmt->bind_param("s", $email);     $stmt->execute();     $result = $stmt->get_result();     $rowcount = $result->num_rows;             if ($rowcount > 0){                 echo "1";             } else if($rowcount == 0){                  echo "0";             }  } ?> 

and 1 not working , gives me error

" fatal error: call member function bind_param() on non-object in line 8 "

<?php session_start(); require 'mysql.php';      $userid = $_session["userid"];      $stmt = $connect->prepare("select * character userid=? ");     $stmt->bind_param("i", $userid); // line 8     $stmt->execute();     $result = $stmt->get_result();     $rowcount = $result->num_rows;         if ($rowcount > 0){             echo "1";         }else{             echo "0";         }   ?> 

they same first 1 checks email , 1 checks userid second 1 not working , first 1 working fine problem ???

because character reserved kerword in mysql must in backtick query fails due , got error

$stmt = $connect->prepare("select * `character` userid=? "); 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -