Re: Cant set info in DB...HELP
| From: | Stut | Date: | Sun, 03 Jun 2007 02:52:53 +0000 |
| Subject: | Re: Cant set info in DB...HELP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256020@lists.php.net to get a copy of this message | ||
Please include the list on all replies.
K.Hayes wrote:
I don't know if I'm escaping the 'vars correctly'. If I'm wrong can you give me an example? <snip>
$sql_query = "INSERT INTO contestants (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclName', '$sclCity', 'sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; $insert_query = mysqli_real_escape_string($connection, $sql_query); mysqli_query($connection,$insert_query); ?>No, this is not the right way. I suggest you read the manual page on mysqli_real_escape_string (http://php.net/mysqli_real_escape_string). You need to run it on every variable you are using *in* the SQL query, not on the SQL query itself. Google for a php mysqli tutorial - all this stuff is very basic and should be covered by most tutorials you'll find. -Stut