2017-08-02 42 views
0

的C:\ xampp \ htdocs \ rmzworld \ qoute.php中獲取非對象的屬性,而在Dreamweaver的第241行中則沒有任何內容。但我想我的插入查詢中有一個問題。請檢閱它,並建議我一個好方法。謝謝!嘗試在第241行

它顯示了我的錯誤是注意:試圖讓用C非對象的屬性:\ XAMPP \ htdocs中\ rmzworld \ qoute.php上線241

進一步它顯示了我插入查詢與我這樣的數據: 錯誤:INSERT INTO order_details(full_name,email,image,name,phone,delievered_location,ordered_location,quantity,style,)VALUES('namra','[email protected]''圖片詳細信息長文本' 'IMG-20150612-WA0001.jpg','0333586874','sialkot','pakistan','5000','hello') 下面是我的php代碼。

<?php 
if(isset($_POST['submit'])) 
     { 
      $con=mysql_connect("localhost","root",""); 
      mysql_select_db("rmzworld",$con); 

      $full_name = $_POST['full_name']; 
      $email = $_POST['email']; 
      $phone = $_POST['phone']; 
      $delievered_location = $_POST['delievered_location']; 
      $ordered_location = $_POST['ordered_location']; 
      $quantity = $_POST['quantity']; 
      $style = $_POST['style']; 

      if(getimagesize($_FILES['image']['tmp_name']) == FALSE) 
      { 
       echo "Please select an image."; 
      } 
      else{ 
      // for adding image in mysql 

       $image= addslashes($_FILES['image']['tmp_name']); 
       $name= addslashes($_FILES['image']['name']); 
       $image= file_get_contents($image); 
       $image= base64_encode($image); 

       // for image extension 
       $file_ext=explode('.',$_FILES['image']['name']) ; 
$file_ext=end($file_ext); 
$file_ext=strtolower(end(explode('.',$_FILES['image']['name']))); 
       $extensions = array("jpeg","jpg","png"); 
       if(in_array($file_ext,$extensions) === false){ 
$errors[]="extension not allowed"; 

} 
      $sql ="INSERT INTO order_details (full_name, email, image, name, 
    phone, delievered_location, ordered_location, quantity, style,) 
    VALUES ('"[email protected]$full_name."', '"[email protected]$email."','"[email protected]$image."', '"[email protected]$name."', 
    '"[email protected]$phone."', '"[email protected]$delievered_location."', '"[email protected]$ordered_location."', 
    '"[email protected]$quantity."', '"[email protected]$style."')"; 

$result=mysql_query($sql,$con); 
      if($result) { 
?> <script> alert('New Account created successfully'); </script> <?php 
} else { 
echo "Error: " . $sql . "<br>" . $con->error; 
} 
} 
}  
?> 

回答

0

變化

$sql ="INSERT INTO order_details (full_name, email, image, name, 
    phone, delievered_location, ordered_location, quantity, style,) 
    VALUES ('"[email protected]$full_name."', '"[email protected]$email."','"[email protected]$image."', '"[email protected]$name."', 
    '"[email protected]$phone."', '"[email protected]$delievered_location."', '"[email protected]$ordered_location."', 
    '"[email protected]$quantity."', '"[email protected]$style."')"; 

$sql ="INSERT INTO order_details (full_name, email, image, name, 
    phone, delievered_location, ordered_location, quantity, style) 
    VALUES ('$full_name', '$email','$image', '$name', 
    '$phone', '$delievered_location', '$ordered_location', 
    '$quantity', '$style')"; 

變化完成:

1)$sql ="INSERT INTO order_details (full_name,... style,) ^Remove Comma

2)取下值追加@

$sql ="INSERT INTO order_details (full_name ....) VALUES ('"[email protected]$full_name."', 
                  ^Remove 

The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead