Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to insert into specific row in database?
    primarykey
    data
    text
    <p>Okay, so my database is as follows by this order:</p> <p>id (primary - auto_increment), username (unique), password, fname, mail</p> <p>I have it so that users register a username and password and it adds it to the database, first of all. No username can be the same, and when it does add the data to the database it auto increments the ID. All of that works, but now I made an account settings page in which the user can change their email and first name, but it isn't working. I have the user enter variables in a form on one page, and it posts their first name as ufname (for update first name) and umail (for update mail). Then on the next page which updates the database I have this code:</p> <pre><code>session_start(); if(!isset($_SESSION['userId'])) { die("&amp;nbsp;You are not signed in. Please &lt;a href='login.php'&gt;click here&lt;/a&gt; to sign in."); } else { $changeTXT = $_SESSION['username']; $changeTXT = strtolower($changeTXT); $changeTXT = ucfirst($changeTXT); echo "Account Settings: &lt;font color='red'&gt;" . $changeTXT . "&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;"; $ufname = $_POST['ufname']; $umail = $_POST['umail']; mysql_connect("localhost", "root", "sp1151") or die(mysql_error()); mysql_select_db("usersys") or die(mysql_error()); mysql_query("INSERT INTO userdb (id, username, password, fname, mail) VALUES('','','','$ufname', '$umail') "); echo $umail . "&lt;br /&gt;&lt;br /&gt;"; echo $ufname; } </code></pre> <p>Oh, I also have the users logged in on sessions too.</p> <p>But how would I insert the first name and e-mail the user enters into their specific row on the database? My database name is userdb.</p>
    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.
    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