Yesuhshosting wrote:should mysql_real_escape_string be used on all text fields besides ones that are integer only in that case use (int)
uhshosting wrote:what is the proper syntax for mysql_real_escape_string in a form such as
uhshosting wrote:aswell as int as in
$email = mysql_real_escape_string($_POST['email']); $zip = (int)$_POST['zip'];This should be done after validation.
Exactly right, the email validation could still allow mysql control characters, but the zip one which limits to numbers and spaces would not. Saying that a space could cause a mysql erroruhshosting wrote: ALSO i have validation for them would that eliminate SQL injection already? ( i doubt the email validation would prevent SQL injection but the Zip mostly)
UPDATE `table` SET `zip` = 12 364 WHERE `id` = 12would cause a syntax error I think, but no harm can come from it, just wont work right.