create.php is the file that is being used to create my database
Code: Select all
<?PHP
//connect to the database - please change your username and password according to given by your web host
$connect = mysql_connect("localhost", "root", " ") or
die ("Hey loser, check your server connection.");
//Create the ecommerce database
if (mysql_create_db("my database")) {
echo "Woo hoo! Database created!";
}
else echo "Sorry, try creating the database again.";
mysql_select_db ("ffmm");
//Define the product table
$query = "CREATE TABLE templates (
template_id CHAR(5) NOT NULL AUTO_INCREMENT,
template_category TEXT NOT NULL,
template_image TEXT NOT NULL,
template_sources TEXT NOT NULL,
template_pages TEXT NOT NULL,
template_price DEC (10,2) NOT NULL,
template_status INT(10) NOT NULL,
PRIMARY KEY(template_id))";
$product = mysql_query($query)
or die(mysql_error());
//Define the customer table
$query2 = "CREATE TABLE members (
member_id INT(6) NOT NULL AUTO_INCREMENT,
member_name TEXT NOT NULL,
member_email TEXT NOT NULL,
member_phone TEXT NOT NULL,
member_password TEXT NOT NULL,
PRIMARY KEY (member_id))";
$customers = mysql_query($query2)
or die(mysql_error());
//Define the general order table
$query3 = "CREATE TABLE ordermain (
ordernum INT(6) NOT NULL AUTO_INCREMENT,
orderdate DATE NOT NULL,
custnum INT(6) NOT NULL,
subtotal DEC (7,2) NOT NULL,
total DEC(7,2) NOT NULL,
custname VARCHAR(15) NOT NULL,
custemail VARCHAR(50),
PRIMARY KEY(ordernum)) ";
$ordermain = mysql_query($query3)
or die(mysql_error());
//Define the order details table
$query4 = "CREATE TABLE orderdet (
ordernum INT (6) NOT NULL,
qty INT(3) NOT NULL,
prodnum CHAR(5) NOT NULL,
KEY(ordernum))";
$orderdet = mysql_query($query4)
or die(mysql_error());
echo "TABLES SUCCESSFULLY CREATED!START TEMPLATING...";
?>Sorry, try creating the database again.Incorrect column specifier for column 'template_id'
i dont know whats going on with that, ive ben fooling it with for the last 4 days with no luck.
I have another file called viewtemplate.php, which is the file that supposed to allow the user to view the template, and then have the option to add it to the cart. That file looks like this:
Code: Select all
<?php
include "header.php";
require "conn.php";
//set up sql statement
$templateid=$_REQUEST['template'];
$query = "SELECT * FROM templates WHERE template_id='$templateid'";
$results = mysql_query($query)
or die(mysql_error());
$row = mysql_fetch_array($results);
extract ($row);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<br>
<table width="600" height="500" align="center">
<td width="600" height="400" colspan="2" align="center">
<br><img src="Admin/templates/<?php echo $template_image; ?>" align="middle" width="400" height="450" border="1"> <br><br>
<a href="templates4.php?page=1"><font face="Arial" size="1"><< Back To Templates</font></a>
</td>
<?php
echo "<td><font face=\"Arial\" size=\"2\" color=\"#000000\"> Template Sources: <br> <b> " . $template_sources . " </b></font><br><br>";
echo "<font face=\"Arial\" size=\"2\" color=\"#000000\"> No. of Pages: <br> <b> " . $template_pages . " </b></font> <br><br> ";
echo "<font face=\"Arial\" size=\"2\" color=\"#000000\"> Template Category: <br> <b> " . $template_category . " </b></font> <br><br> ";
echo "<font face=\"Arial\" size=\"2\" color=\"#000000\"> Template Price: <br> <b> $ " . $template_price . " </b></font> <br><br> ";
?>
<form method="POST" action="add.php">
Quantity:
<input type="text" name="qty" size="2"> <br>
<input type="hidden" name="prodnum" value="<?php echo $template_id ?>"><br>
<input type="submit" name="Submit" value="Add to cart"><br>
</form>
<form method = "POST" action="cart.php">
<input type="submit" name="Submit" value="View cart">
</form>
</td>
</table>
</body>
</html>Warning: extract(): First argument should be an array in /u327/hostname/viewtemplate.php on line 10
If anybody can help me out and tell me whats going on and how to fix it, I will gladly appreciate it. I will now be ending this post since its so long and proceed to the 2nd part of the error messages in another post. thanks