Note that there are some explanatory texts on larger screens.

plurals
  1. POGet value of this field into this variable
    primarykey
    data
    text
    <pre><code>&lt;?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="dbname"; // Database name $tbl_name="Student"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword $salt = '~Z`!@#$%I^&amp;*()_-+Q=}]{[\|"&gt;&lt;'; $myusername = mysql_real_escape_string($_POST['regduser']); $mypassword = $_POST['regdpass']; $mypassword = hash('sha512', $mypassword.$salt); $sql = "SELECT * FROM $tbl_name WHERE regduser = '$myusername' AND regdpass = '$mypassword')"; $studentID = $_POST['stuID']; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count=1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("regduser"); session_register("regdpass"); header("location:/student.php?stuID=$studentID"); } else { echo "$mypassword&lt;br /&gt;"; echo "$badpasses&lt;br&gt;"; echo "Wrong Username or Password"; } ob_end_flush(); ?&gt; </code></pre> <p>Specifically on this line:</p> <pre><code>header("location:/student.php?stuID=$studentID"); </code></pre> <p>Why isn't <code>$studentID</code> getting any value in the above code? The field name <code>stuID</code> is getting selected in the <code>SELECT</code> statement above it. How do I get this value to be the value of <code>$studentID</code> ?</p> <p>Thanks. Sorry if its a little newbish, I'm new to php.</p>
    singulars
    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.
    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