BiLLiXx BiLLiXx - 6 months ago 21
PHP Question

a mysql request, nothing happen?

in PHP; a got this mysql request:

$q=@mysql_query("INSERT INTO personnes(login,pass,user_email,logged_ip,created,user_first_name,user_last_name,user_organization,user_address1,user_address2,user_city,
user_country,user_zip,user_phone,userer_fax) VALUES ('".mysql_escape_real_string($login)."', '".mysql_escape_real_string($pass)."', '".mysql_escape_real_string($user_mail)."',
'".mysql_escape_real_string($ip)."', '".mysql_escape_real_string( $dates)."', '".mysql_escape_real_string($first_name)."', '".mysql_escape_real_string($last_name)."',
'".mysql_escape_real_string($organisation)."', '".mysql_escape_real_string($address1)."', '".mysql_escape_real_string($address2)."', '".mysql_escape_real_string($city)."',
'".mysql_escape_real_string('France')."', '".mysql_escape_real_string($zip)."', '".mysql_escape_real_string($phone)."', '".mysql_escape_real_string($fax)."')");


Well; I use to got some troubles with this request, because of types ..etc; but when I finally have no error; nothing happens.
I put an ECHO after the request, but it is never reached
Thank you

Answer

Code Should be

$q=mysql_query("INSERT INTO personnes(login,pass,user_email,logged_ip,created,user_first_name,user_last_name,user_organization,user_address1,user_address2,user_city, 
            user_country,user_zip,user_phone,userer_fax) VALUES ('".mysql_real_escape_string($login)."', '".mysql_real_escape_string($pass)."', '".mysql_real_escape_string($user_mail)."', 
            '".mysql_real_escape_string($ip)."', '".mysql_real_escape_string( $dates)."', '".mysql_real_escape_string($first_name)."', '".mysql_real_escape_string($last_name)."', 
            '".mysql_real_escape_string($organisation)."', '".mysql_real_escape_string($address1)."', '".mysql_real_escape_string($address2)."', '".mysql_real_escape_string($city)."', 
            '".mysql_real_escape_string('France')."', '".mysql_real_escape_string($zip)."', '".mysql_real_escape_string($phone)."', '".mysql_real_escape_string($fax)."')");

Note : mysql_* functions are deprecated in 5.6 and removed in 7!!

Deprecated as of PHP 5.5 and removed in PHP 7