运行下面显示的代码时,出现此错误:(!)
Parse error: syntax error, unexpected T_SL in D:\Program Files\wamp\www\Fatz\Fatz Shopping Cart.php on line 13
代码:
<?php
$_Session['Basket'] = '';
$User = 'Username';
$Pass = 'Password';
$Database = 'database';
mysql_connect(localhost, $User, $Pass);
@mysql_select_db($Database) or die('Unable to select database');
$sql = <<<MySQL_Query; <!-- Error Line-->
CREATE TABLE IF NOT EXISTS Test
{
ItemID int(3) unsigned NOT NULL auto_increment,
Title varchar(128) NOT NULL default '',
Price decimal(3,2) NOT NULL default '',
PRIMARY KEY (ItemID)
} MySQL_Query;
mysql_query($sql);
INSERT INTO Test VALUES (1, 'What are we selling!', '10.00');
function ShoppingBaskItems()
{
$basket = $_Session['Basket'];
If(!isset($basket) || null($basket)) return '0 Items';
$Items = explode(',', $basket);
$Count = (count($Items) > 1) ? 'Count': '';
return '<p><a href="Basket.php">'.count($Items).' items'.$Count.' </a></p>';
}
echo ShoppingBaskItems();
?>