<?
$width= $_POST ['Width_1'];
$height= $_POST ['Height_1'];
$desc='1';
$amount= '12';
$o_id= $_GET ['data1'];
$extra = $_GET ['extratype'];
$size= '4x6';
$paper= $_GET ['papertype'];
/* Connect to database */
$db= mysql_connect("localhost", "", "");
mysql_select_db("", $db);
$lastphoto = mysql_query("SELECT photo_id
FROM order_line
ORDER BY photo_id DESC LIMIT 1");
while($row= mysql_fetch_array($lastphoto))
{
$newlastphoto= ($row["photo_id"]+1);
}
$newtype="SELECT type_id FROM `type` WHERE extra='$extra' AND size='$size' AND paper='$paper'";
if( !($type_id=mysql_query($newtype)) ) {
die('Error SQL query');
}
$type_id=mysql_query($newtype);
while ($result=mysql_fetch_array($type_id)){
// echo $result['type_id']."<br/>";
$t_id= $result['type_id'];
}
$sql= "INSERT INTO order_line
VALUES ('$newlastphoto', '$fileName', '$amount', '$width', '$height', '$desc', '$t_id', '$o_id')";
mysql_query($sql);
?>