Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL error when adding special characters, specialy at sign, even with mysql_real_escape_string() method
    primarykey
    data
    text
    <p>I am tying to make a user system with a mysql database. I have tried to insert a row into a table with the following php code:</p> <pre><code>$UserCreateQueryText = "INSERT INTO users ( Username, Password, FirstName, LastName, eMail, ID, ClearanceLevel) VALUES ( " . $User . ", " . $Password . ", " . $FirstName . ", " . $LastName . ", " . $eMailToUse . ", NULL, 1)"; $UserCreateQuery = mysql_query($UserCreateQueryText) or die(" User creation query error: " . mysql_error()); </code></pre> <p>The Variables I used are defined as follows:</p> <pre><code>$User = mysql_real_escape_string($_GET["Username"]); $Password = mysql_real_escape_string($_GET["Password"]); $FirstName = mysql_real_escape_string($_GET["FirstName"]); $LastName = mysql_real_escape_string($_GET["LastName"]); $eMail = mysql_real_escape_string($_GET["eMail"]); </code></pre> <p>I used $_GET so I could see the variables were actually being passed correctly.</p> <p>So, if I inserted a eMail (example@domain.com) the result of $UserCreateQueryText would be:</p> <pre><code>INSERT INTO users ( Username, Password, FirstName, LastName, eMail, ID, ClearanceLevel) VALUES ( username, password, Name, LastName, , NULL, 1) </code></pre> <p>so getting the eMail field clear and an error is thrown back:</p> <pre><code>User creation query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' NULL, 1)' at line 4 </code></pre> <p>-Ric Del (<a href="http://www.foxtailgames.com.mx" rel="nofollow">foxtailgames.com.mx</a>)</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.
 

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