adrianlewis
05-09-2004, 05:24 AM
Hi All,
having major problems with the following code. The code wont insert the info into the database however I know it connecting to the database because it displays how many rows are in the database and I can enter data using PHPMyAdmin...
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
print ("'$ProdID', '$Type', '$Cat', '$Name', '$ProdDesc', '$Temp', '$Size', '$Price', '$Stock'");
/* Start of PHP3 Script */
/* Data of SQL-server */
$server= "xxxxxx"; /* Address of 1&1 database server */
$user= "xxxxxx"; /* FTP-username */
$password= "xxxxxx"; /* FTP-Password */
$database= "xxxxxx"; /* name of database */
$table= "ORCProducts"; /* Name of table, you can select that */
/* Accessing SQL-Server and querying table */
$Link = MYSQL_CONNECT($server, $user, $password) or die ( "<H3>Server unreachable</H3>");
MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>");
MYSQL_QUERY( "INSERT INTO $table VALUES('$ProdID', '$Type', '$Cat', '$Name', '$ProdDesc', '$Temp', '$Size', '$Price', '$Stock')");
/* Display number of entries */
$number=MYSQL_NUMROWS(MYSQL_QUERY( "SELECT * FROM $table"));
if ($number==0):
echo "database empty";
elseif ($number > 0):
echo "$number rows in database";
endif;
/* Close SQL-Connection */
MYSQL_CLOSE();
?>
<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">The new product has been added to the database</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><a href="AllProductsAdmin.php">CONTINUE...</a></font></p>
</body>
</html>
Any ideas what might be wrong because im stumped at the mo?
Thanks
Adrian
having major problems with the following code. The code wont insert the info into the database however I know it connecting to the database because it displays how many rows are in the database and I can enter data using PHPMyAdmin...
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
print ("'$ProdID', '$Type', '$Cat', '$Name', '$ProdDesc', '$Temp', '$Size', '$Price', '$Stock'");
/* Start of PHP3 Script */
/* Data of SQL-server */
$server= "xxxxxx"; /* Address of 1&1 database server */
$user= "xxxxxx"; /* FTP-username */
$password= "xxxxxx"; /* FTP-Password */
$database= "xxxxxx"; /* name of database */
$table= "ORCProducts"; /* Name of table, you can select that */
/* Accessing SQL-Server and querying table */
$Link = MYSQL_CONNECT($server, $user, $password) or die ( "<H3>Server unreachable</H3>");
MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>");
MYSQL_QUERY( "INSERT INTO $table VALUES('$ProdID', '$Type', '$Cat', '$Name', '$ProdDesc', '$Temp', '$Size', '$Price', '$Stock')");
/* Display number of entries */
$number=MYSQL_NUMROWS(MYSQL_QUERY( "SELECT * FROM $table"));
if ($number==0):
echo "database empty";
elseif ($number > 0):
echo "$number rows in database";
endif;
/* Close SQL-Connection */
MYSQL_CLOSE();
?>
<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">The new product has been added to the database</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><a href="AllProductsAdmin.php">CONTINUE...</a></font></p>
</body>
</html>
Any ideas what might be wrong because im stumped at the mo?
Thanks
Adrian