Jump to content

[SOLVED] Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING


Recommended Posts

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

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.

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

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());

?>

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());
?>

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.