Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- what is wrong with this code
- class MyClass {
- private $db;
- // Constructor
- function __construct() {
- $this->db = new mysqli('localhost', 'root', 'root', 'Test_db');
- $this->db->autocommit(FALSE);
- }
- // Destructor
- function __destruct() {
- $this->db->close();
- }
- // Main method
- function MyFun() {
- // Check for required parameters
- if (isset($_POST["name"]) && isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["email"])) {
- echo "Before n";
- $name = $_POST["name"];
- $username = $_POST["username"];
- $password = $_POST["password"];
- $email = $_POST["email"];
- $activation = 0;
- echo "After n";
- // tracking
- $stmt = $this->db->prepare("INSERT INTO users (name, username, password, email,activation) VALUES (?, ?, ?, ?, ?)");
- $stmt->bind_param("is", $name, $username, $password, $email, $activation); //Line 95
- $stmt->execute();
- $stmt->close();
- }
- [15-Apr-2011 15:09:10] PHP Warning: mysqli_stmt::bind_param() [<a href='function.mysqli-stmt-bind-param'>function.mysqli-stmt-bind-param</a>]: Number of elements in type definition string doesn't match number of bind variables in /Applications/MAMP/htdocs/Test/reg.php on line 95
- $stmt->bind_param("is", $name, $username, $password, $email, $activation);
- $stmt->bind_param("sssss", $name, $username, $password, $email, $activation);
- $stmt->bind_param("is", $name, $username, $password, $email, $activation);
- $stmt = $this->db->prepare("INSERT INTO users (name, username, password, email,activation) VALUES (?, ?, ?, ?, ?)");
- $stmt->bind_param($name, $username, $password, $email, $activation);
- $stmt = $this->db->prepare("INSERT INTO users (**is**, name, username, password, email,activation) VALUES (?, ?, ?, ?, ?)");
- $stmt->bind_param("**is**", $name, $username, $password, $email, $activation);
Add Comment
Please, Sign In to add comment