2012-03-09 4 views
0

私はeBayのようなオンラインオークションハウスを作りたがっています。私のウェブサイトでは、商品の入札を完了した後、買い手(入札者)と売り手の両方にSMSが送信されます。すべてのコードはうまくいきますが、次のページでは解決できないエラーがあります。私はこのページを私のページのすべてに含める。私のページのいずれかを開くと、何らかのエラーが表示されます。エラーが::私はまた、ユーザー登録、買い手(入札者)の通知などとしてSMSいくつかのページを送信するためのいくつかのコードを使用しphpでozekiメッセージサーバーでsmsを送信する際にエラーが発生しましたか?

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( "UPDATE製品セットのステータス= '1' のproduct_id = '$のPRODUCT_ID' ANDが< '$今日exp_date WHERE")または死ぬ(mysql_error());

UPDATEクエリは行を返しません。クエリは良いですが、場合は

を行うことはできません(はmysql_num_rows($負荷)> 0)

はmysql_rows_affectedまたはその

ような何かしてみてください
関連する問題