Re: Parse Error on SQL Insert

From: Date: Fri, 07 Apr 2006 19:44:31 +0000
Subject: Re: Parse Error on SQL Insert
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-233471@lists.php.net to get a copy of this message
Tom Chubb wrote:
I'm working on an insert record page with a multiple file upload script of which I understand the fundamentals. However, on submission I am getting the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\apache2triad\htdocs\damotors\admin\insertnew.php on line 34 Where line 34 is... $insertSQL = "INSERT INTO cars (model, year, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale'])"; <snip>
I've been slaving away for an hour and it's probably something really obvious but I'd really appreciate it if someone could point it out to me please? Previously I was getting an "image1 cannot be null" error which I couldn't work out either. That's gone, but I still can't work out what's going on.
Without seeing more code (the error is probably above line 34), I can only guess that the problem is with your posted data. Escape your data before you insert it into a db. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#233471) next »