Hi,
Ouuuuuuf, I do pass many hours to resolv this. NOTHING!!!
I do connect to database witount the problem.
But this code doesnt save into my database.
- $SQL->bind_param($SQL,'sssssd', $firstName, $lastname, $gender, $email, $passw, $num);
Its gives this error:
Fatal error: Uncaught Error: Call to a member function bind_param() on bool in C:\xampp\htdocs\dashboard\RegistrationForm_save\connect.php:51 Stack trace: #0 {main} thrown in C:\xampp\htdocs\dashboard\RegistrationForm_save\connect.php on line 34
Please this my codes:
index.html
- <!DOCTYPE html>
- <html>
- <head>
- <title>Registration Page</title>
- <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
- </head>
- <body>
- <div class="container">
- <div class="row col-md-6 col-md-offset-3">
- <div class="panel panel-primary">
- <div class="panel-heading text-center">
- <h1>Registration Form</h1>
- </div>
- <div class="panel-body">
- <form action="connect.php" method="post">
- <div class="form-group">
- <label for="firstName">First Name</label>
- <input type="text" class="form-control" id="firstName" />
- </div>
- <div class="form-group">
- <label for="lastName">Last Name</label>
- <input type="text" class="form-control" id="lastName" />
- </div>
- <div class="form-group">
- <label for="email">Gender</label>
- <div>
- <label for="male" class="radio-inline"><input type="radio" name="gender" value="m" id="male">Male</label>
- <label for="female" class="radio-inline"><input type="radio" name="gender" value="m" id="male">Female</label>
- <label for="others" class="radio-inline"><input type="radio" name="gender" value="o" id="male">Others</label>
- </div>
- </div>
- <div class="form-group">
- <label for="email">Email</label>
- <input type="text" class="form-control" id="email" name="email" />
- </div>
- <div class="form-group">
- <label for="passw">password</label>
- <input type="passw" class="form-control" id="passw" name="passw" />
- </div>
- <div class="form-group">
- <label for="num">Phone Number</label>
- <input type="num" class="form-control" id="num" name="num" />
- </div>
- <input type="submit" class="btn btn-primary">
- </form>
- </div>
- <div class="panel-footer text-right">
- <small>© Israel Mfwamba</small>
- </div>
- </div>
index.php
- $servername = "localhost:3307";
- $database = "registrationform1";
- $db_found = new mysqli($servername, $database );
- $SQL = $db_found->prepare("INSERT INTO registration (firstName, lastname, gender, email, passw, num) VALUES (?, ?, ?, ?, ?, ?)");
-
- $SQL->bind_param($SQL,'sssssd', $firstName, $lastname, $gender, $email, $passw, $num);
- $SQL->execute();
- $stmt = $conn->prepare($SELECT);
- $stmt->bind_param("s", $firstName, $lastname, $gender, $email, $passw, $num);
- $stmt->execute();
- $stmt->bind_result($firstName, $lastname, $gender, $email, $passw, $num);
- $stmt->store_result();
- $rnum = $stmt->num_rows;
- if ($rnum==0)
- {
- $stmt->close();
- $stmt = $conn->prepare($INSERT);
- $stmt->bind_param("ssssss", $firstName, $lastname, $gender, $email, $passw, $num);
- $stmt->execute();
- echo "New record inserted sucessfully";
- }
- ?>