Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8826939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:15:56+00:00 2026-06-14T07:15:56+00:00

This is the first time I have ever used Mysqli, so when it comes

  • 0

This is the first time I have ever used Mysqli, so when it comes to adding information in the database I am a little lost. Here is the script that I have.

<?php
include("config.php");

$username = $_POST['username'];
$password = $_POST['password'];
$passcheck = $_POST['password-check'];
$email = $_POST['email'];
$address = $_POST['address'];
$suite = $_POST['apt'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$passcrypt = md5($passcheck);

if($_POST['submit']){
$stmt = $db->prepare("SELECT * FROM `accounts` WHERE `username`= ?");
$stmt->bind_param('s', $username);
$stmt->execute();
if($stmt->num_rows != 0){
$final_report = "That username already exists.";
}
if($password <> $passcheck){
$final_report = "Your passwords do not match";
}
if($final_report == NULL){
$stmt = $db->prepare("INSERT INTO `accounts` (`email`, `username`, `password`, `address`, `city`, `state`, `zip`) VALUES (?, ?, ?, ?, ?, ?, ?)");
if (false === $stmt) {
    var_dump($db->error);
}
$stmt->bind_param('sssssss',$email, $username, $passcrypt, $address, $city, $state, $zip);
$stmt->execute();
}
$stmt->close();
}
?>
<form method="POST" action="">
<?php
if($final_report != NULL){
print"{$final_report}";
}
?>
<table>
<tr>
<td>Username:</td>
<td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td>Repeat Password:</td>
<td><input type="password" name="password-check" /></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Address:</td>
<td><input type="text" name="address" /></td>
</tr>
<tr>
<td>Apt #/Suite:</td>
<td><input type="text" name="apt" /></td>
</tr>
<tr>
<td>City:</td>
<td><input type="text" name="city" /></td>
</tr>
<tr>
<td>State:</td>
<td><input type="text" name="state" /></td>
</tr>
<tr>
<td>Zip Code:</td>
<td><input type="text" name="zip" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Submit" /></td>
</tr>
</table>
</form>

and these are the errors I am returning once the page is submitted.
Notice: Undefined variable: final_report in C:\xampp\htdocs\gptcode\signup.php on line 25

string(0) ""

Fatal error: Call to a member function bind_param() on a non-object in C:\xampp\htdocs\gptcode\signup.php on line 30

I am not worried about the notice obviously, but the vardump() is showing nothing so I am not sure what is causing the error for bind_param() I have triple checked table and column names. If the code here is right then my question is, if the actual table has more values and columns in which are listed will it produce such an error, because I did not include all of the columns in the prepare statement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:15:57+00:00Added an answer on June 14, 2026 at 7:15 am

    an undefinied var is not NULL use isset($varname)

    if you use PDO its bindParam not bind_param

    why bind the params in the first place if you use them only once, give an array to execute():

    $stmt = $db->prepare("INSERT INTO `accounts` (`email`, `username`, `password`, `address`, `city`, `state`, `zip`) VALUES (:email, :username, :password, :address, :city, :state, :zip)");
    
    $stmt->execute(array(
      ':email' => $mail,
      ':username' => $username,
    .... and so on.
    ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first time posting here, I have a question which I have
I have a database that is currently sharded. This is the first time that
Sorry, this's my first time to ask a question here. So, I don't have
I have used maps many times before, but this is the first time I
I have recently started learning F#, and this is the first time I've ever
This is the first time I have manipulated hashes and arrays in this way
This is the first time I have attempted to create a .dll, that will
So this is my first time I have to work with the IPad camera
It's the first time I have done anything like this but wondered what the
I am using $SUB for the first time and have come across this problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.