1. Product Display page
Copy CodeThe code is as follows:
if (Trim ($info [tupian]== ""))
{
echo "No picture";
}
Else
{
?>
"Width=" "height=" border= "0" > }
?>
|
|
" " |
|
"Market Price: " |
|
"Member Price: " |
|
"> View Information" |
|
"> Add to Cart" |
|
"Quantity Remaining: if ($info [shuliang]-$info [Cishu]) >0)
{
Echo ($info [shuliang]-$info [Cishu]);
}
Else
{
echo "Sold out";
}
?> " |
}
?>
2. Document addgouwuche.php
Copy the Code code as follows:
Session_Start ();
Include ("conn.php");
if ($_session[username]== "")
{
echo "";
Exit
}
$id =strval ($_get[id]);
$sql =mysql_query ("select * from Shangpin where id= '". $id. "'", $conn);
$info =mysql_fetch_array ($sql);
if ($info [shuliang]<=0)
{
echo "";
Exit
}
$array =explode ("@", $_session[producelist]);
for ($i =0; $i<>
{
if ($array [$i]== $id)
{
echo "";
Exit
}
}
$_session[producelist]=$_session[producelist]. $id. " @";
$_session[quatity]=$_session[quatity]. " 1@ ";
Header ("location:gouwu1.php");
?>
3. Document gouwu1.php
Copy the Code code as follows:
Session_Start ();
if ($_session[username]== "")
{
echo "";
Exit
}
?>
Include ("top.php");
?>
3. Document gouwu2.php
Copy the Code code as follows:
if ($_get[dingdanhao]!= "")
{$DD =$_get[dingdanhao];
Session_Start ();
$array =explode ("@", $_session[producelist]);
$sum =count ($array) *20+260;
echo "";
}
?>
4. Database configuration file conn.php
Copy the Code code as follows:
$conn =mysql_connect ("localhost", "root", "") or Die ("Database Server connection Error". Mysql_error ());
mysql_select_db ("Shop", $conn) or Die ("Database access Error". Mysql_error ());
mysql_query ("Set character set gb2312");
mysql_query ("Set names gb2312");
?>