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
-
Registration Page - "stylesheet" type="text/css" href="css/bootstrap.css">
- class="container">class="row col-md-6 col-md-offset-3">class="panel panel-primary">class="panel-heading text-center">
Registration Form
class="panel-body">- method="post">
class="form-group">- ="firstName">First Name
- "text" class="form-control" id="firstName" />
class="form-group">- ="lastName">Last Name
- "text" class="form-control" id="lastName" />
class="form-group">- ="email">Gender
- ="male" class="radio-inline">"radio" name="gender" value="m" id="male">Male
- ="female" class="radio-inline">"radio" name="gender" value="m" id="male">Female
- ="others" class="radio-inline">"radio" name="gender" value="o" id="male">Others
class="form-group">- ="email">Email
- "text" class="form-control" id="email" name="email" />
class="form-group">- ="passw">password
- "passw" class="form-control" id="passw" name="passw" />
class="form-group">- ="num">Phone Number
- "num" class="form-control" id="num" name="num" />
- "submit" class="btn btn-primary">
class="panel-footer text-right">- © Israel Mfwamba
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('ssssss', $firstName, $lastname, $gender, $email, $passw, $num);
- $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";
- }
- ?>
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Jan 30, 2021, 12:07 PM
Kiran MohantyPosted Jan 30, 2021, 12:01 PM
Rajanikant HawaldarPosted Jan 30, 2021, 11:46 AM