Hi, I am developing a website for a magazine shop! and In the admin page i have add new product, the product has 5 fields, ProdID is an auto increment, ProdName, ProdDiscrip, ProdCost and ProdPic. The Problem I am having is with the ProdPic, This is to hold the picture of the magazine, I have tried saving it as a blob, then saving it as text but its just keeps coming up with the box with a red x. I am using a brows button to find the file and write it to the php page. I echo what the value of the brows feild, for example my images are saved in an image folder, U:\www\wishing\images\actionfigures.jpg but in the mysql database there are no \. here is the code I have so far:
Html Add New Prod
<html>
<head>
<title> Insert New Product </title>
</head>
<p><b> This Page Will Allow You To Insert A New Product </b></p>
<p><a href="Adminpage.html">Press To Go Back To Admin Page! </a></p>
<form action="InsertnewProd.php" method="POST">
<p> Product Name: <input type="text" name="prodname">
<p> Product Discription: <textarea name="proddiscript"></textarea>
<p> Product Cost: <input type="text" name="prodcost">
<p> Product Picture <input type="file" name="pic">
<p><input type="submit" value="Add Product" style="background: #ff3600; font-weight: bold"> <input type="reset" value="Clear" style="background: #fff862; font-weight: bold">
</form>
</body>
</html>
Php Add New Prod
<html>
<head>
<title> Insert New Product </title>
</head>
<body>
<p><a href="Adminpage.html">Press To Go Back To Admin Page! </a></p>
<?
//Get Values From HTML Form
$prodname = $_POST['prodname'];
$proddiscript = $_POST['proddiscript'];
$prodcost = $_POST['prodcost'];
$prodpic = $_POST['pic'];
echo $prodpic;
$user = "root";
$password = "no";
$database = "wishingwell";
// Connect to Database
mysql_connect("localhost",$user);
@mysql_select_db($database) or die("Please Contact A Member Of Adminatration!");
// Query
$query = "INSERT INTO tblproducts VALUES('','$prodname','$proddiscript','$prodcost','$prodpic')";
mysql_query($query);
// Close Database
mysql_close();
// Message
echo "New Product Added";
?>
</body>
</html>
View Products php
<html>
<head>
<title> View Products </title>
</head>
<body>
<p><a href="Adminpage.html">Press To Go Back To Admin Page! </a></p>
<table border="1" cellspacing ="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif"> Product ID </font></th>
<th><font face="Arial, Helvetica, sans-serif"> Product Name </font></th>
<th><font face="Arial, Helvetica, sans-serif"> Product Discription </font></th>
<th><font face="Arial, Helvetica, sans-serif"> Product Cost </font></th>
<th><font face="Arial, Helvetica, sans-serif"> Product Picture </font></th>
<?
$user = "root";
$password = "no";
$database = "wishingwell";
// Connect To The Database
mysql_connect("localhost",$user);
@mysql_select_db($database) or die("Try Again If This Message comes up conntact Adminatration!");
// Query
$query = "Select * From tblproducts";
mysql_query($query);
//number of records
$result = mysql_query($query);
$num = mysql_numrows($result);
// print number of records
echo "<b> There Are $num Products Saved";
// Close database
mysql_close();
// Inizialise counter
$i=0;
//Create A While loop so that it will loop through all records puting the values under the headings
while ($i < $num)
{ // Start While loop
//Put all values from database into varables
$prodID=mysql_result($result,$i,"ProdID");
$prodname=mysql_result($result,$i,"ProdName");
$proddis=mysql_result($result,$i,"ProdDiscrip");
$prodcost=mysql_result($result,$i,"ProdCost");
$prodpic=mysql_result($result,$i,"ProdPic");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $prodID; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $prodname; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $proddis; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $prodcost; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><img src="<? print $prodpic;?>"></font></td>
<tr>
<?
// Incroment Counter
$i++;
} // End While Loop
?>
</body>
</html>
Thank You For Reading This, and I hope Someone Has The Answer