Parse Error on SQL Insert

From: Date: Fri, 07 Apr 2006 19:37:43 +0000
Subject: Parse Error on SQL Insert
Groups: php.general 
Request: Send a blank email to php-general+get-233470@lists.php.net to get a copy of this message
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'])"; For info, the HTML for the form is as follows: <tr valign="baseline"> <td nowrap align="right">Image1:</td> <td><input type="file" name="image[]"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Image2:</td> <td><input type="file" name="image[]"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Image3:</td> <td><input type="file" name="image[]"></td> </tr> 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. Many thanks, Tom -- Tom Chubb tom@ps-promo.co.uk 07915 053312

« previous php.general (#233470) next »