0

您好,从昨天开始,我试图在区块链上获取交易哈希发送许多 api 并发送到 mysql,但它不起作用。我在 mysql $txid 处插入,但根据示例“2147483647”给出了错误的结果,我非常感谢您的帮助。下面是我的代码。

<p>$guid=&quot;***********&quot;;
$firstpassword=&quot;**********&quot;;
$secondpassword=&quot;**************&quot;;
$amounta=&quot;3599&quot;;
$amountb=&quot;2000&quot;;
$amountc=&quot;2000&quot;;
$addressa=&quot;********&quot;;
$addressb=&quot;***********&quot;;
$addressc=&quot;******&quot;;
$recipients=urlencode('{
&quot;'.$addressa.'&quot;: '.$amounta.',
&quot;'.$addressb.'&quot;: '.$amountb.',
&quot;'.$addressc.'&quot;: '.$amountc.'
}');
$json_url = 
&quot;https://blockchain.info/pt/merchant/$guid/sendmany?password=******&amp;second_password=********&amp;recipients=$recipients&amp;note=********&quot;;

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$message = $json_feed-&gt;message;
$txid = $json_feed-&gt;tx_hash;
$tx = &quot;$txid&quot;;

$servername = &quot;localhost&quot;;
$username = &quot;******&quot;;
$password = &quot;*******&quot;;
$dbname = &quot;*****&quot;;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn-&gt;connect_error) {
die(&quot;Connection failed: &quot; . $conn-&gt;connect_error);
}
$<font color="#FF0000">sql = &quot;INSERT INTO payments (user_id, transaction_hash, 
payment, date)
VALUES ('5331', '$txid', '4', now())&quot;;
if ($conn-&gt;query($sql) === TRUE) {
echo &quot;New record created successfully&quot;;
} else {
echo &quot;Error: &quot; . $sql . &quot;&lt;br&gt;&quot; . $conn-&gt;error;<br>
}

$conn-&gt;close();
?&gt; 
4

1 回答 1

0

大声笑,对不起,scrypt 工作得很好,问题是我将表设置为 INT 11,所以我将其更改为 vachar 255 并且它工作得很好。

谢谢

于 2015-05-24T22:55:14.583 回答