0
我想將我在數組中的信息插入到MySQL表中。這裏是我的代碼:PHP和mysqli查詢返回錯誤?
include "db_conx.php";
$transactionid = array(); //stores our output
所以首先我們抓住從URL中的結果,然後我們使用preg_match_all找到我們正在尋找的標籤:從上面的表達式
$url = file_get_contents("https://blockchain.info/address/1CRBDxjEQV317Q9DZZ13kVE23d2iY9Brqg?filter=2");
preg_match_all('#<a class="hash-link" href="/tx/([a-zA-Z0-9]*)">([a-zA-Z0-9]*)</a>#Uis', $url, $matches);
抓鬥每場比賽^:
foreach($matches[0] as $transactionids){
$transactionid[] = "<div class='transactionids' >".$transactionids."</div>";
}
準備數據庫結果:
$iresult = mysqli_query("INSERT INTO bitcoin (transaction) VALUES ("$transactionid[$i]")");
然後,這是我的循環,我用它來記錄結果:
for($i = 0; $i < count($transactionid); $i++){
$iresult .= $transactionid[$i];
}
但它返回此錯誤:讀取三個答案低於現在插入經過這麼:
Parse error: syntax error, unexpected '$transactionid' on line 21
編輯空行而不是信息。
嗯,這讓我的地方。現在它輸入一個空行。 – joeytrumann