Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Problem with prepared statements

General discussions related to php

Moderators: macek, egami, gesf

Problem with prepared statements

Postby chiba2012 » Sat Jan 04, 2014 5:31 am

Code: Select all
function register($first_name,$last_name,$email,$password)
{

   $conn = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
   $stmt = $conn->prepare("insert into users values (null, ?,?,?,?,? NOW())");
   $level=0;
   $stmt->bind_param("ssssi",$first_name,$last_name,$email,$password,$level);


   $stmt->execute();
}


This is the database i'm trying to insert into, id is auo increment.

Type Collation
id int(10)
first_name varchar(45)
last_name varchar(45)
email varchar(80)
pass varchar(40)
level int(10)
date_joined datetime

I get this error
Fatal error: Call to a member function bind_param() on a non-object in /home/content/27/9433527/html/core/functions.php on line 27

How can I fix it?
chiba2012
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sat Jan 04, 2014 5:27 am

Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.