Re: syntax question

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

 



Ross wrote:
Can I put post values directly into insert statements?

$query = "INSERT INTO categories (category_name) VALUES ('$_POST['cat_name'])";
Yes, although this is not recommended.
What is someone puts a single quote in there? Or some other bad characters....

otherwise... 2 options:

$query = "INSERT INTO categories (category_name) VALUES ('".$_POST['cat_name']."')";
-or-
$query = "INSERT INTO categories (category_name) VALUES ('{$_POST['cat_name']}')";

-Brad

--
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