1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php require("configure.php"); ?> <? $productsid = $_POST["productsid"]; $catid = $_POST["catid"]; //$image = $_POST["image"];
$sql = "select max(productsid) as maxid "; $sql .= "from products"; $result=mysql_query($sql); $row = mysql_fetch_array($result,MYSQL_ASSOC); $productsid = $row{maxid}+1;
if ($_FILES['image']['name'] <> '') { copy ($_FILES['image']['tmp_name'], "../product/".$productsid.$_FILES['image']['name']) or die ("Could not copy"); $image = $productsid.$_FILES['image']['name']; } else { $image = ""; }
//if (is_numeric($sortby)<>1) // $sortby = 0; //header("Location: catsubindex.php");
//$creationdate = date("F j, Y, g:i a");
mysql_query("insert into products (productsid, catid, image) values ('$productsid', '$catid', '$image')"); mysql_close($dbh);
header("Location: productsindex.php?msg=Add Successful"); ?>
|