954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

MySQLi keeps returning "Incorrect arguments to mysql_stmt_execute" D:

I'm hosting on NetworkSolutions (which has PHP 5.2.17) and every time I make a prepared statement it returns the error "Incorrect arguments to mysql_stmt_execute" D:

Can you help me spot the error in my code please? D:

<?php 
 $mysqli=new mysqli(host, username, password, db);
 $query="INSERT INTO `Variables` VALUES (?, ?)"; 
 $stmt=$mysqli->prepare($query); 
 $stmt->bind_param("ss", $cake, $lol); 
 $cake="lol"; 
 $lol="pie"; 
 $stmt->execute(); 
 echo $mysqli->error; 
 $stmt->close(); 
 $mysqli->close(); 
?>


However, when I run a prepared statement with only ONE parameter marker, it works :o

<?php 
 $mysqli=new mysqli(host, username, password, db);
 $query="INSERT INTO `Variables` VALUES (?, 'lolcats')"; 
 $stmt=$mysqli->prepare($query); 
 $stmt->bind_param("s", $cake); 
 $cake="lol"; 
 $lol="pie"; 
 $stmt->execute(); 
 echo $mysqli->error; 
 $stmt->close(); 
 $mysqli->close(); 
?>


Queries work too o: The only thing that doesn't work is using more than one parameter marker D: Can you help me find out why?

Thanks

GigsD4X
Light Poster
31 posts since May 2010
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You