Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble entering session variables into mysql
    text
    copied!<p>So I'm trying to input some session variables into the database, and I'm successfuly inserting all rows, except the $_SESSION['organisationId']. Some context: A user lands on a url as the one given in the snippit below, I get the organisationId, then want that user to be assigned that organisationId when they create the account - working as a sort of 'invite-system' of sorts. </p> <p>// This is the URL I am using: <a href="http://thisapp.com/login.php?competitionId=51da7ed4d686a&amp;organisationId=51d81cab92709" rel="nofollow">http://thisapp.com/login.php?competitionId=51da7ed4d686a&amp;organisationId=51d81cab92709</a></p> <pre><code> &lt;?php session_start(); ob_start(); ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); include('db.php'); $_SESSION['competitionId'] = $_GET['competitionId']; $_SESSION['organisationId'] = $_GET['organisationId']; &lt;h4&gt;Create your Account&lt;/h4&gt; &lt;form action="login.php" method="post" name="acceptinvite"&gt; name: &lt;input type="text" name="createname"&gt;&lt;br&gt; email: &lt;input type="text" name="createemail"&gt;&lt;br&gt; password: &lt;input type="password" name="createpassword"&gt;&lt;br&gt; &lt;input type="submit" value="Create Account"&gt; &lt;/form&gt; &lt;?php if (isset($_POST["createname"]) &amp;&amp; !empty($_POST["createname"])) { //define variables $name = mysql_real_escape_string($_POST['createname']); $email = mysql_real_escape_string($_POST['createemail']); $password = mysql_real_escape_string($_POST['createpassword']); $teamLeader = 0; $organisationId = mysql_real_escape_string($_SESSION['organisationId']); $orgName = mysql_real_escape_string($_SESSION['orgName']); //finish registering the user $acceptInviteTeam = ("INSERT INTO `users` (`organisationId`, `name`, `email`, `password`, `isTeamLeader`) VALUES ('$organisationId', '$name', '$email', '$password', '$teamLeader')"); $result = mysql_query($acceptInviteTeam) or die (mysql_error()); } else { echo "Fill out the form and use the correct credentials"; } ?&gt; </code></pre>
 

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