I'm new to all this stuff...
The following file links through to a main file that allows access to the MySQL DB... but it is not picking up anything from the DB... is there something wrong with the code... would appreciate your help.
Code: Select all
<html>
<head>
</head>
<body>
<?
require("Cart.php");
DBinfo();
Brand();
Root();
mysql_connect("$DBHost","$DBUser","$DBPass");
mysql_select_db($DBName);
if ($UID != "") {
$result=mysql_query("SELECT * FROM Users WHERE User='$UID'");
$num=mysql_num_rows($result);
if ($num == "0") {
$dt=date( "YmdHis");
$UID= "$dt$REMOTE_ADDR";
$date=date( "z");
mysql_query("INSERT INTO Users VALUES ('$UID','$date')");
Header( "Location: $PHP_SELF?CA=$CA&UID=$UID");
}
}
if ($UID == "") {
$dt=date( "YmdHis");
$UID= "$dt$REMOTE_ADDR";
$date=date( "z");
mysql_query("INSERT INTO Users VALUES ('$UID','$date')");
}
commonHeader("$Company","Select an item");
$result=mysql_query("SELECT * FROM Items WHERE Category='$CA' ORDER BY ItemName");
fontFace("Arial","Select an item:<br><br>");
echo "<ul>";
while ($row = mysql_fetch_row($result)) {
$IS=$rowї0];
$IN=$rowї1];
$ID=$rowї2];
$IC=$rowї3];
$Ca=$rowї4];
$SC=$rowї5];
$II=$rowї6];
fontFace("Arial","<li><a href='$Relative/description.php?II=$II&UID=$UID'>$IN</a>");
if ($ID != "") {
fontFace("Arial"," - $ID"); }
echo "</li>";
}
echo "</ul>";
commonFooter($Relative,$UID);
?></body></html>Code: Select all
<?/* Replace these variables with information about your company */
$Company ="donassi co";
$Address1="555 Any St.";
$Address2="PO Box 3";
$City ="London";
$State ="UK";
$Zip ="BR7 6EZ";
$Phone ="+44 077 590 13806";
$Web ="http://www.yoursite.com/";
$Email ="don_assi@postmaster.co.uk";
$NoShipping = "Shipping Extra";
function Brand() {
global $Company,$Address1,$Address2,$City,$State,$Zip,$Phone,$Web,$Email,$NoShipping;
}
/* Replace these variables with information for connecting to your
database server */
$DBHost="hermes";
$DBUser="gassi01";
$DBPass="Capone77";
$DBName="gassi01db";
function DBInfo() {
global $DBHost,$DBUser,$DBPass,$DBName;
}
/* Replace these variables with the absolute and relative paths to your
MyCart scripts */
$WebRoot="home/gassi01/public_www/Cart";
$Relative="/~gassi01/Cart";
$WebHost="hermes.dcs.bbk.ac.uk";
function Root() {
global $WebRoot,$Relative,$WebHost;
}
function redFont($font,$text) {
echo "<FONT FACE="$font" COLOR="red">$text</FONT>";
}
function blueFont($font,$text) {
echo "<FONT FACE="$font" COLOR="blue">$text</FONT>";
}
function colorFont($color,$font,$text) {
echo "<FONT FACE="$font" COLOR="$color">$text</FONT>";
}
function fontFace($font,$text) {
echo "<FONT FACE="$font">$text</FONT>";
}
function fontSize($size,$color,$font,$text) {
echo "<FONT FACE="$font" COLOR="$color" SIZE="$size">$text</FONT>";
}
function commonHeader($Company,$title) {
echo "<HTML><TITLE>$Company Shopping Cart - $title</TITLE><BODY BGCOLOR="#FFFFFF">";
}
function receiptHeader($Company,$title) {
echo "<HTML><TITLE>$Company Receipt - $title</TITLE><BODY BGCOLOR="#FFFFFF">";
}
function commonFooter($Relative,$UID) {
echo "<center><br><br><hr width="70%"><br>";
echo "<b><a href="$Relative/checkout.php?UID=$UID">Go To The Check Out Stand</a></b><br><br>";
echo "<b><a href="$Relative/viewCart.php?UID=$UID">View The Contents Of Your Cart</a></b><br><br>";
fontFace("Arial","<a href="$Relative/index.php?UID=$UID">Our Catalog</a>");
fontFace("Arial"," | <a href="/">Home</a>");
echo "<br><br></center></BODY></HTML>";
}
function adminFooter($Relative) {
echo "<center><br><br><hr width="70%"><br>";
fontFace("Arial"," | <a href="$Relative">Our Catalog</a>");
fontFace("Arial"," | <a href="$Relative/admin/">Shopping Cart Admin</a>");
fontFace("Arial"," | <a href="http://modems.rosenet.net/mysql/">MySQL Utilities</a>");
fontFace("Arial"," | <a href="http://www.rosenet.net/">Rosenet</a>");
echo "<br><br></center></BODY></HTML>";
}
function receiptFooter($Company) {
echo "<br><br><center>";
fontFace("Arial","Thank you for ordering from <b>$Company</b>");
echo "</center><br><br>";
}?>thanks don_assi