2016-08-02 46 views
-1

這是我的代碼。我執行然後沒有發生。請檢查我的代碼PHP Mysqli。需要從表中提取數據

$id = trim(htmlentities($_REQUEST['id'],ENT_QUOTES)); //call the action from previous page 

//fetch data 
$stmt = $dbi->prepare("SELECT a.telco, a.no_siri, a.no_topup, a.amount, a.requestingAgentID, a.requestDateTime, a.isUsed, b.name FROM card_telco a LEFT JOIN agents b ON a.requestingAgentID = b.id WHERE id = ?"); //query 
$stmt->bind_param('s', $id); //binding 
mysqli_stmt_execute($stmt); //execute 
mysqli_stmt_store_result($stmt); //store the result 
$count = mysqli_stmt_num_rows($stmt); //execute rows 
$stmt->bind_result($newTelco, $noSiri, $noTopup, $newAmount, $newRequestAgentID, $newRequestDateTime, $isUsing, $newName, $agendId); //binding new result 
$stmt->execute() or die(mysqli_error()); //execute the statement 
$stmt->store_result() //store new result 
$stmt->fetch(); //fetch the data 
$stmt->close(); //close the statement 

ChromePhp::log('here'); //console 
ChromePhp::log($newTelco, $noSiri); //console 
+0

您得到的任何錯誤? –

+0

@Anant我的localhost說,頁面不工作。 – krxckz

+0

'$ stmt-> bind_param('i',$ id); //'綁定' –

回答

0

好吧,我明白了!我的查詢是錯誤的。 SELECT a.id,a.telco,a.no_siri,a.no_topup,a.amount,a.requestingAgentID,a.requestDateTime,a.isUsed,b.name FROM card_telco a LEFT JOIN agents b ON a。 requestsAgentID = b.id WHERE a.id =?

這是我的新查詢。感謝您的幫助