Topic: PHP ERROR
Everything is working but i am not able send Query of IMG name to the database and also couldn't save image to a folder. please help me
I am newbie to php so please dont mind.
<?php
require('login/connect.php');
ini_set("display_errors", "1");
error_reporting(E_ALL ^ E_DEPRECATED);
$p_name = $_POST['p_name'];
$p_desc = $_POST['p_desc'];
$p_man = $_POST['p_man'];
$p_brand = $_POST['p_brand'];
$p_model = $_POST['p_model'];
$p_sku = $_POST['p_sku'];
$p_price = $_POST['p_price'];
$p_sprice = $_POST['p_sprice'];
$p_qun = $_POST['p_qun'];
$p_weight = $_POST['p_weight'];
$p_color = $_POST['p_color'];
$p_size = $_POST['p_size'];
$p_img = $_FILES['p_img'];
if (($p_img["type"] == "image/jpeg") || ($p_img["type"] == "image/jpg") || ($p_img["type"] == "image/png") || ($p_img["type"] == "image/PNG") || ($p_img["type"] == "image/JPG")) {
echo $path = '../uploads/'.$FILES["p_img"]["p_img"];
if (move_uploaded_file($p_img['tmp_name'],$path )){
$sql= "INSERT INTO `upload`(`p_name`, `p_desc`, `p_man`, `p_brand`, `p_model`, `p_sku`, `p_price`, `p_sprice`, `p_qun`, `p_weight`, `p_color`, `p_size`, `p_img`) VALUES ('$p_name','$p_desc','$p_man','$p_brand','$p_model','$p_sku','$p_price','$p_sprice','$p_qun','$p_weight','$p_color','$p_size','$p_img')";
$result = mysql_query($sql);
if($result){
header("location:login/thankyou.php");
}else{
echo '<script type="text/javascript">';
echo 'alert("mysql_error()")';
echo '</script>';
}
}else{
echo "Please Try Again";
}
}else{
echo "Invalid image";
}
?>