如何运行sql查询!empty($ _ POST [''])是真的吗?

The result of the block of code below is always "d=0".I dont understand why?

 if (!empty($_POST["transactionid"])) {

     $sql_set = "SET timestamp = '$timestamp',";
     $sql = "INSERT INTO phpclassifieds_payments
                $sql_set
                txnid = '$trnxid',
                adid  = '$adid',
                adtype = 'A',
                amountpaid ='$amount_paid'";

     $tx = mysql_query($sql);
     if ($tx) {
         $d = 1;
     } else {
         $d = 0;
     }
 }

See : MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET

Are you sure that your DBMS allow the INSERT INTO ... SET syntax ?

Maybe change it to :

INSERT INTO phpclassifieds_payments VALUES ('val 1', 'val 2', ...);

Try to debug it with :

$d = 0;
die('error sql : ' . mysql_error());

If mysql_error, it doesn't return any value try echo $sql; to see your sql query.

You must check have any bugs in your queries by using

echo "<pre>".mysql_error()."</pre>"

It'll returns the mysql error information of query just before processed.

You must also ensure that their is a space between your table name and SET statement,

just rewrite $sql_set = " SET timestamp = '$timestamp', ";

Otherwise your joined query string is

INSERT INTO phpclassifieds_paymentsSET timestamp = '$timestamp',
                txnid = '$trnxid',
                adid  = '$adid',
                adtype = 'A',
                amountpaid ='$amount_paid'