Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING o

This is very basic.

I hope someone will help me while I’m looking the solution in google.com

Anyway here is the line 20 codes,


mysql_query("INSERT INTO portfolio (category, title, description, version, started, finished)
	VALUES ($_POST['select'], $title, $_POST['description'], $_POST['version'], $_POST['started'], $_POST['finished'])");

and this is the error below,
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/coder9/public_html/adventure/submit_to_db.php on line 20

Thanks in advanced.

PHP: Arrays - Manual Scroll down to see this:


<?php
// Show all errors
error_reporting(E_ALL);

$arr = array('fruit' => 'apple', 'veggie' => 'carrot');

// Correct
print $arr['fruit'];  // apple
print $arr['veggie']; // carrot

// Incorrect.  This works but also throws a PHP error of level E_NOTICE because
// of an undefined constant named fruit
// 
// Notice: Use of undefined constant fruit - assumed 'fruit' in...
print $arr[fruit];    // apple

// This defines a constant to demonstrate what's going on.  The value 'veggie'
// is assigned to a constant named fruit.
define('fruit', 'veggie');

// Notice the difference now
print $arr['fruit'];  // apple
print $arr[fruit];    // carrot

// The following is okay, as it's inside a string. Constants are not looked for
// within strings, so no E_NOTICE occurs here
print "Hello $arr[fruit]";      // Hello apple

// With one exception: braces surrounding arrays within strings allows constants
// to be interpreted
print "Hello {$arr[fruit]}";    // Hello carrot
print "Hello {$arr['fruit']}";  // Hello apple

// This will not work, and will result in a parse error, such as:
// Parse error: parse error, expecting T_STRING' or T_VARIABLE' or T_NUM_STRING'
// This of course applies to using superglobals in strings as well
print "Hello $arr['fruit']";
print "Hello $_GET['foo']";

So change your line to :


mysql_query("INSERT INTO portfolio (category, title, description, version, started, finished)
	VALUES ({$_POST['select']}, {$title}, {$_POST['description']}, {$_POST['version']}, {$_POST['started']}, {$_POST['finished']})");