Re: Cant set info in DB...HELP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



K. Hayes wrote:
What "lists" are you referring to? Also this is how the examples show I've seen.

I mean hit "Reply to all" in your mail client. That way you include the email address of the PHP General mailing list so everyone, including the archives, can see your reply.

I know this is basic general stuff but I try many times before posting, and I have followed all directions given.

Change the following line...

mysqli_query($connection,$sql_query); ?>

to...

mysqli_query($connection,$sql_query)
    or die("Query failed: ".mysqli_error($connection);

If you still get no output, check error_reporting and display_errors in your php.ini file to make sure you are seeing at least errors and warnings.

-Stut

===========================END NEW CODE=====================================


----- Original Message ----- From: "Stut" <stuttle@xxxxxxxxx>
To: "K.Hayes" <k3cheese@xxxxxxxxxxxxx>
Cc: "php-general" <php-general@xxxxxxxxxxxxx>
Sent: Saturday, June 02, 2007 9:52 PM
Subject: Re:  Cant set info in DB...HELP


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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux