Alex Posted September 27, 2009 Share Posted September 27, 2009 There's just an extra ( like the error says: find this: '"($_POST['password']"' And edit it to: '" . md5(md5($_POST['password'])) . "' Edit: The code that you quoted isn't what MadTechie posted.. copy his original code and it'll work.. Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925865 Share on other sites More sharing options...
Matthew Herren Posted September 27, 2009 Author Share Posted September 27, 2009 no i'm getting Parse error: syntax error, unexpected T_VARIABLE in l/formdata/auto/submit.php on line 3 Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925866 Share on other sites More sharing options...
mrMarcus Posted September 27, 2009 Share Posted September 27, 2009 your variables going into the db are all mixed up .. they need to be lined up to ensure success. look... `name`,`last`,`mi`,`add`,`add2`,`city`,`state`,`zip`,`hp`,`cp`,`work`,`email`,`make`,`model`,`color`,`plate`) VALUES ('{$_POST['name']}','{$_POST['last']}','{$_POST['mi']}','{$_POST['phone']}','{$_POST['cp']}','{$_POST['wp']}','{$_POST['add']}','{$_POST['add2']}','{$_POST['city']}','{$_POST['state']}','{$_POST['zip']}','"($_POST['password']"','{$_POST['make']}','{$_POST['model']},{$_POST['color']}','{$_POST['plate']}')"; you have: `name`,`last`,`mi`,`add` as field names, then, after `mi`, you start inserting different values, `$_POST['phone']`,`$_POST['cp']` .. should be `$_POST['add']`,`$_POST['add2']` .. and so on. also, double-hashing your password is less secure than a single hash 'md5(md5($_POST['password']))' as i seen in one of your other posts .. single hash with salt is your best line of security. using multiple hashes can lead to hash collisions. lining your query up with proper vars to fields should eliminate the 'not inserting issue' .. start there, and then see if you get an error, otherwise, you're just wasting everybody's time. Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925867 Share on other sites More sharing options...
Matthew Herren Posted September 27, 2009 Author Share Posted September 27, 2009 Parse error: syntax error, unexpected T_VARIABLE in l/formdata/auto/submit.php on line 3 Still getting that error after i lined everything up like you suggested mrMarcus Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925875 Share on other sites More sharing options...
mrMarcus Posted September 27, 2009 Share Posted September 27, 2009 can you repost the most updated code, please? Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925876 Share on other sites More sharing options...
Matthew Herren Posted September 27, 2009 Author Share Posted September 27, 2009 sorry here it is. and now i'm getting Parse error: syntax error, unexpected $end in /auto/submit.php on line 32 <?php $connect=mysql_connect("localhost","dbuser","dbpassword"); $sql="INSERT INTO`dbase`.`auto`( `name`, `last`, `mi`, `phone`, `cp`, `wp`, `email`' `add`, `add2`, `city`, `state`, `zip`, `password` ) VALUES ( '{$_POST['name']}', '{$_POST['last']}', '{$_POST['mi']}', '{$_POST['phone']}', '{$_POST['cp']}', '{$_POST['wp']}', '{$_POST['email']}', '{$_POST['add']}', '{$_POST['add2']}', '{$_POST['city']}', '{$_POST['state']}', '{$_POST['zip']}', '{$_POST['password']}' $res=mysql_query($sql)or die(mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925879 Share on other sites More sharing options...
Alex Posted September 27, 2009 Share Posted September 27, 2009 You were missing )"; at the end. <?php $connect=mysql_connect("localhost","dbuser","dbpassword"); $sql="INSERT INTO`dbase`.`auto`( `name`, `last`, `mi`, `phone`, `cp`, `wp`, `email`' `add`, `add2`, `city`, `state`, `zip`, `password` ) VALUES ( '{$_POST['name']}', '{$_POST['last']}', '{$_POST['mi']}', '{$_POST['phone']}', '{$_POST['cp']}', '{$_POST['wp']}', '{$_POST['email']}', '{$_POST['add']}', '{$_POST['add2']}', '{$_POST['city']}', '{$_POST['state']}', '{$_POST['zip']}', '{$_POST['password']}')"; $res=mysql_query($sql)or die(mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925881 Share on other sites More sharing options...
mrMarcus Posted September 27, 2009 Share Posted September 27, 2009 ^beat me to it. Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925882 Share on other sites More sharing options...
Matthew Herren Posted September 27, 2009 Author Share Posted September 27, 2009 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' `add`, `add2`, `city`, `state`, `zip`, `password` ) VALUES ( 'mATThew', 'hERRE' at line 8 I'm running MySQL 5.0 Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925889 Share on other sites More sharing options...
Alex Posted September 27, 2009 Share Posted September 27, 2009 I found another problem.. `email`' Should be: `email`, Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-925890 Share on other sites More sharing options...
Matthew Herren Posted October 3, 2009 Author Share Posted October 3, 2009 Gott it thanks Quote Link to comment https://forums.phpfreaks.com/topic/175655-solved-parse-error-syntax-error-unexpected-t_constant_encapsed_string/page/2/#findComment-929384 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.