Note that there are some explanatory texts on larger screens.

plurals
  1. POI can connect to mysql db but my table is not updating
    primarykey
    data
    text
    <p>I am able connect to mysql db where i have created a table called attorney_users. I would like to know what i am missing or doing wrong? I have post my function code below. when i register the user it confirms the success, but the table is not updated.</p> <pre><code>&lt;?php require_once('appvars.php'); require_once('connectvars.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if (isset($_POST['submit'])) { // Grab the profile data from the POST $username = mysqli_real_escape_string($dbc, trim($_POST['username'])); $firstname = mysqli_real_escape_string($dbc, trim($_POST['firstname'])); $lastname = mysqli_real_escape_string($dbc, trim($_POST['lastname'])); $firmname = mysqli_real_escape_string($dbc, trim($_POST['firmname'])); $email = mysqli_real_escape_string($dbc, trim($_POST['email'])); $password = mysqli_real_escape_string($dbc, trim($_POST['password'])); $password2 = mysqli_real_escape_string($dbc, trim($_POST['password2'])); if (!empty($username) &amp;&amp; !empty($password) &amp;&amp; !empty($password2) &amp;&amp; ($password == $password2)) { // Make sure someone isn't already registered using this username $query = "SELECT * FROM attorney_users WHERE username = '$username'"; $data = mysqli_query($dbc, $query); if (mysqli_num_rows($data) == 0) { // The username is unique, so insert the data into the database $query = "INSERT INTO attorney_users (username, firstname, lastname, firmname, email, password, date) VALUES ('$username', '$firstname', '$lastname', $firmname, $email, SHA('$password'), NOW())"; mysqli_query($dbc, $query); // Confirm success with the user echo '&lt;p&gt;Your new account has been successfully created. You\'re now ready to &lt;a href="index.php"&gt;log in&lt;/a&gt;.&lt;/p&gt;'; mysqli_close($dbc); exit(); } else { // An account already exists for this username, so display an error message echo '&lt;p class="error"&gt;An account already exists for this username. Please use a different username.&lt;/p&gt;'; $username = ""; } } else { echo '&lt;p class="error"&gt;You must enter all of the sign-up data, including the desired password twice.&lt;/p&gt;'; } } mysqli_close($dbc); ?&gt; &lt;div id="main-wrapper"&gt; &lt;div id="register-wrapper"&gt; &lt;form method="post" action = "&lt;?php echo $_SERVER['PHP_SELF'];?&gt;"&gt; &lt;fieldset&gt; &lt;ul&gt; &lt;label for="username"&gt;Username : &lt;/label&gt; &lt;input type="text" id="username" name = "username" value = "&lt;?php if (!empty($username)) echo $username; ?&gt;" /&gt; &lt;label for="firstname"&gt;First Name : &lt;/label&gt; &lt;input type="text" id="firstname" name = "firstname" /&gt; &lt;label for="lastname"&gt;Last Name : &lt;/label&gt; &lt;input type="text" id="lastname" name = "lastname" /&gt; &lt;label for="firmn"&gt;Firm Name : &lt;/label&gt; &lt;input type="text" id="firmname" name = "firmname" /&gt; &lt;label for="email"&gt;Email : &lt;/label&gt; &lt;input type="text" id="email" name = "email" /&gt; &lt;label for="password"&gt;Password : &lt;/label&gt; &lt;input type="password" id="password" name="password" /&gt; &lt;label for="password2"&gt;Verify Password : &lt;/label&gt; &lt;input type="password" id="password2" name="password2" /&gt; &lt;/li&gt; &lt;li class="buttons"&gt; &lt;input type="submit" value="Register" name="submit" /&gt; &lt;input type="button" name="cancel" value="Cancel" onclick="location.href='index.php'" /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload