Bickey Posted January 13, 2011 Share Posted January 13, 2011 I just did a simple modification to this code and it doesn't seem to work now. CODE 1 works but CODE 2 doesn't. Could someone help me fix CODE 2. CODE 1 mysql_query("INSERT INTO tbl (username, password, surname, firstname, nickname, company, street, suburb, postal, phone, email, product, status, id) VALUES ('$username', '$password', '$surname', '$firstname', '$nickname', '$company', '$street', '$suburb', '$postal', '$phone', '$email', '$product', '$status', '$id')"); CODE 2 $go =sprintf("INSERT INTO tbl (username, password, surname, firstname, nickname, company, street, suburb, postal, phone, email, product, status, id) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'", mysql_real_escape_string($username), mysql_real_escape_string($password), mysql_real_escape_string($surname), mysql_real_escape_string($firstname), mysql_real_escape_string($nickname), mysql_real_escape_string($company), mysql_real_escape_string($streetx), mysql_real_escape_string($suburb), mysql_real_escape_string($postal), mysql_real_escape_string($phone), mysql_real_escape_string($email), mysql_real_escape_string($product), mysql_real_escape_string($status), mysql_real_escape_string($id)); $result = mysql_query($go); Quote Link to comment https://forums.phpfreaks.com/topic/224293-code-1-and-code-2/ Share on other sites More sharing options...
denno020 Posted January 13, 2011 Share Posted January 13, 2011 Is it supposed to be streetx in CODE 2?? Denno Quote Link to comment https://forums.phpfreaks.com/topic/224293-code-1-and-code-2/#findComment-1158843 Share on other sites More sharing options...
Bickey Posted January 13, 2011 Author Share Posted January 13, 2011 Yep!!! that did it! Thanks! Bickey. Quote Link to comment https://forums.phpfreaks.com/topic/224293-code-1-and-code-2/#findComment-1158846 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.