1

I am getting this error continuously:

Call to a member function bind_param() on boolean*

It generally appears when we try operation on a table that does not exist and prepare statement returns false, but I have a structured table. My prepared statements are:

$query = "INSERT INTO `profiles`(name,email,handle,DOB,profilePic,gender,r_lat,r_lon,c_lat,"
               . "c_lon,connections,recentActivities,savedItems,achievements,school,"
               . "interestsB,interestsI,interestsE,work,coverPic,bio,fb_url,insta_url,link_url,wordpress_url,"
               . "other_url,address,range,phone)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

PS: I am open to all suggestions.

       $stmt=$mysqli->prepare($query);
       $stmt->bind_param("ssssssddddsssssssssssssssssii",$name,$email,$handle,$DOB,$profilePic,$gender,$r_lat,$r_lon,$c_lat,$c_lon,
               $connections,$recentActivities,$savedItems,$achievements,$school,$interestsB,
               $interestsI,$interestsE,$work,$coverPic,$bio,$fb_url,$insta_url,$link_url,$wordpress_url,
               $other_url,$address,$range,$phone);
       $res = $stmt->execute();
       return $res;  

I am posting screenshots:

enter image description here

printing the error returns:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'range,phone)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' at line 1

Mureinik
  • 277,661
  • 50
  • 283
  • 320
  • https://stackoverflow.com/questions/27394710/fatal-error-call-to-a-member-function-bind-param-on-boolean – Hakuna Matata Jun 29 '18 at 08:43
  • I tries this too....... This is what I am getting: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'range,phone)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' at line 1null can't figure out this too – user9254999 Jun 29 '18 at 09:07
  • use the conditional debug in your eclipse/intellij which parameter is actually is null. – Hakuna Matata Jun 29 '18 at 09:34

1 Answers1

2

range is a reserved word in MySQL. You could escape it by surrounding it with forward quotes:

`range`
Mureinik
  • 277,661
  • 50
  • 283
  • 320