Re: Double Trouble!
| From: | Leif K-Brooks | Date: | Tue, 27 May 2003 06:47:15 +0000 |
| Subject: | Re: Double Trouble! | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28062@lists.php.net to get a copy of this message | ||
It's calling the mysql_query function that runs a query, not doing something with the result it generates. If doing something with a functions result called the function again, then
function foo(){
echo "Foo called.";
return 2;
}
$result = foo();
echo $result + 2;
would result in "Foo called.Foo called.4" being outputted, instead of "Foo called.4".
Matthew Moldvan wrote:
Looks to me like you are calling the mysql_query() function twice here:-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.".mysql_error() ); try this instead:$result = mysql_query( $query, $link ); << first if ( ! $result ) << second die ( "Unable to Add Payment to Database:".mysql_error() ); Let me know if that works or not ... it should, though. Regards, Matt. ----- Original Message ----- From: "S. Cole" <s.cole@roadrunner.nf.net>if ( !$result=mysql_query($query, $link) ) die ( "Unable to Add Payment to Database:To: < >Sent: Sunday, May 25, 2003 4:04 PM Subject: [PHP-DB] Double Trouble!I can't seem to find out why I am getting two copies of the same entry inmydatabase. =============================================================== print "Pending Payment - Adding to Database<br>"; $query = "INSERT INTO payments (subscr_id, pmt_date, txn_id, exchange_rate,payer_id,amt_paid, payment_status, pending_reason, payer_email,'$subscr_id','$payment_date','$txn_id','$exchange_rate', '$mc_gross','$payment_status','$pending_reason','$payer_email',payer_status, verify_sign, paypal_fee)VALUES(".mysql_error() );'$payer_id','$payer_status','$verify_sign','$mc_fee')";$result = mysql_query( $query, $link ); if ( ! $result ) die ( "Unable to Add Payment to Database:print "Pending payment - Added to Database<br>"; =============================================================== The print statements at the beginning and end only run once. The script is not called from anywhere else. I don't have any otherscriptsrunning to insert the same info. When I "//" out the query, nothing is added to the database. I have a very similar script for adding a customer to another datbase and now it's doing the same thing. Could it be possible that I change some sort of setting in mysql? S. Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php