2014-01-14 145 views
0

我想刪除行,它正在刪除,但我得到以下錯誤。您可以請看代碼並指導我解決此問題: 錯誤: 警告:mysql_num_rows()期望參數1爲資源,布爾在/home/fqaotczz/public_html/dev/Seller/delete_exec.php中給出行25警告:mysql_num_rows()期望參數1是資源,空給出

CODE 
<?php 

//Get data from Session 
session_start(); 
$userid = $_SESSION['userid']; 

//Get data from URL 
$table = $_GET['table']; 
$favprod = $_GET['favprod']; 
$page = $_GET['page']; 

//Include database connection details 
require_once('../connection.php'); 
include '../Database.class.php'; 
$dbe_obj = new Database_Executer(); 

//Create query 
$query = "DELETE FROM SELLER_PRODUCT WHERE SELLER_PRODUCT.USER_ID = '$userid' AND SELLER_PRODUCT.PRODUCT_ID = '$favprod'"; 

$result = $dbe_obj->delete_query_executer($query) or die($query."<br/>".mysql_error()); 

//Check whether the query was successful or not 
if($result){ 
    ***if(mysql_num_rows($result) > 0) {*** 
     //Delete Successful 

     $member = mysql_fetch_assoc($result); 
     //$first_name = $member["FIRST_NAME"]; 
     //$last_name = $member["LAST_NAME"]; 
     $message = "Record deleted successfully."; 
     header("Location: $page?message=".$message); 

    } 
    else { 
     //Login failed 

     $message = "Record could not be deleted."; 
     header("Location: $page?message=".$message); 
    } 
} 
else { 
    die("Query failed !"); 
} 

?> 

回答

1

您必須使用此http://cz1.php.net/manual/en/function.mysql-affected-rows.php

//Check whether the query was successful or not 
if($result){ 
    ***if(mysql_affected_rows($result) > 0) {*** 
     //Delete Successful 
+0

星爺我試着用mysql_affected_rows()函數但我仍然是戰國策正在添加的。 –

+0

在$ result = $ dbe_o之後嘗試echo mysql_error()... – Pavel

相關問題