2012-03-09 109 views
0

我想做一個像eBay一樣的在線拍賣行。在我的網站上,完成任何產品的投標後,短信將發送給買方(投標人)和賣方。所有代碼運行良好,但在接下來的頁面中,我遇到了一些無法解決的錯誤。我在我的每一頁都包含這個頁面。當我打開我的任何頁面時,顯示一些錯誤。錯誤是::由ozeki消息服務器通過PHP發送短信錯誤?

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\auction\reload.php on line 13 

    Fatal error: Cannot redeclare sendSMS2() (previously declared in D:\xampp\htdocs\auction\reload.php:61) in D:\xampp\htdocs\auction\reload.php on line 68 

我也使用一些代碼發送短信的一些頁面,如用戶註冊,買方(投標人)的通知等。所有的其他代碼做得很好,但下頁讓我麻煩。我的代碼::

Reload.php

<?php  
    mysql_connect("localhost","root","") or die(mysql_error()); 
    mysql_select_db("auction2") or die(mysql_error()); // select database 

    $now = strtotime("now");  // get prisent time 
    $today = date("Y-m-d",$now);  

//after certain time [ given(expire_date) < Today ] product will be deleted by updating value 'status' = '1' 
    $load = mysql_query(" UPDATE product SET status='1' WHERE product_id='$product_id' AND exp_date < '$today' ") or die(mysql_error()); 

if(mysql_num_rows($load) > 0)   // if any product found 
    while($row = mysql_fetch_array($load)) {   //fetch result 
     mysql_select_db("auction2") or die(mysql_error());  // select database 

     $product_id = $row['product_id'];  // select product Id 

     // finding the maximum (money), product_id, seller_name, buyer_name 
     $max = mysql_query("SELECT product_id, seller_name, buyer_name, MAX(money) FROM product_bet 
          WHERE product_id='$product_id' ") or die(mysql_error()); 

     $row2 = mysql_fetch_array($max) or die(mysql_error()); //fetch_result 

     $product_id = $row[0]; //product_id 
     $seller_name = $row[1]; //sellerName 
     $buyer_name = $row[2]; //buyer_Name 
     $money = $row[3];  //maximum money 

     //finding the product name 
     $query = mysql_query("SELECT product_name FROM product WHERE product_id='$product_id' ") or die(mysql_error()); 
     $pro = mysql_fetch_array($query) or die(mysql_error()); //fetch result 

     $productName = $pro['product_name']; //product name 

     //finding seller cell phone number 
     $query2 = mysql_query("SELECT seller_phone FROM seller_info WHERE seller_name='$seller_name' ") or die(mysql_error()); 
     $SP = mysql_fetch_arry($query2) or die(mysql_error()); 
     $sellerPhone = $SP['seller_phone']; //seller cell phone number 


     // finding buyer cell phone number 
     $query3 = mysql_query("SELECT buyer_phone FROM buyer_info WHERE buyer_name='$buyer_name' ") or die(mysql_error()); 
     $SP2 = mysql_fetch_arry($query2) or die(mysql_error()); 
     $buyerPhone = $SP2['buyer_phone']; //buyer cell phone number 

     $msg = "Mr. $seller_name, your product ($productName) is selled at taka $money to". 
      "Mr. $buyer_name. His contact number is $buyerPhone "; // message will be shown on cell phone 


     $msg2 = "Mr. $buyer_name, you win to buy $productName at taka $money". 
     "you can contact with Mr. $buyer_name, His contact number is $buyerPhone "; 

     sendSMS2($sellerPhone, $msg); //function call for sending message to seller 
     sendSMS2($buyerPhone, $msg2); // function call for sending message to buyer 

    }   



     function sendSMS2($phoneNumber, $msg) { // send sms 
    $sql = mysql_select_db("ozekisms") or die(mysql_error()); 

    $sqlX = "INSERT INTO ozekimessageout (receiver, msg, status)". 
         "VALUES ('$phoneNumber', '$msg', 'send')"; 
    $check = mysql_query($sqlX) or die(mysql_error()); 
    //mysql_close("ozekisms", $sql); 
} 
    ?> 

回答

0

$負載=請求mysql_query( 「更新產品設置狀態= '1' WHERE的product_id = '$的product_id' AND EXP_DATE <'$今天的」)或死亡(mysql_error());

UPDATE查詢不返回行。查詢是好的,但你不能做

如果(mysql_num_rows($負載)> 0)

嘗試mysql_rows_affected或類似的東西