View Single Post
Old 12-06-2007, 02:51 AM   #25 (permalink)
SOCK
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

Ok, let's take a look at your code, I'm assuming line 45 is the line with the call to bind_param().
PHP Code:
// Preparing to add customer
$stmt $db->prepare("INSERT INTO clients(user,pass,dir,address,phone,email) VALUES(?,?,?,?,?,?)");

// Let mysqli handle all escaping
$stmt->bind_param("sss"$user$pass$dir$address$phone$email);

// Execute the statement
$stmt->execute(); 
The error states "call to a member function on a non-object". This is telling you that $stmt (which the script expects to be an object that you're using the method bind_param() on) is not an object. In other words, the call to prepare() failed for some reason. Note that prepare() returns a statement object or FALSE. You can troubleshoot with something like this:
PHP Code:
if ( ( $stmt$db->prepare('SQL STATEMENT') ) !== FALSE ) {
    
// assumes a good SQL statement
    // carry on with the bind_param() statement

} else {
    
// returned FALSE for some reason, troubleshoot
    
echo $db->error();

Check your SQL statement carefully. Are there typos? Anything else incorrect?

It's also odd that you only have three strings identified in the call to bind_param()... shouldn't that be 'ssssss'?
SOCK is offline  
Reply With Quote