1
當運行下面我所示的代碼得到這個錯誤:T_SL錯誤,Shoppying籃系統
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();
?>
Mybad,但我補充說,所以我的問題仍然存在 – user1899367
更新了帖子。並刪除您的插入查詢或將其放置在一個變量中。 –
LOL謝謝,對不起有沒有做過一段時間的PHP:D。 – user1899367