我想做一个像ebay这样的在线拍卖行。在我的网站上,任何产品完成投标后,短信将发送给买方(投标人)和卖方。所有代码都运行良好,但在下面的页面中,我遇到了一些无法解决的错误。我把这个页面包含在我的每一个页面中。当我打开我的任何页面时,就会显示一些错误。错误是::
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);
}
?>发布于 2012-03-09 11:29:33
$load = mysql_query(“UPDATE product SET status='1‘WHERE product_id='$product_id’AND exp_date < '$today‘")或die(mysql_error());
UPDATE查询不返回行。查询是正确的,但是您不能这样做
if( mysql_num_rows($load) > 0)
试试mysql_rows_affected或类似的东西
https://stackoverflow.com/questions/9628503
复制相似问题