下面的代碼應該輸出數據庫字段的內容到一個文件,但它只返回lastid
(這是想要的),然後它說Arrray。不輸出字符串到文件
順便說一下$db->query
返回結果集。任何提示我做錯了將不勝感激。
// this is to test values
$myFile = "debugdirectory.txt";
$fh = fopen($myFile,"w");
$res = $db->q("SELECT LAST_INSERT_ID()");
$res = mysql_result($res,0,0);
fwrite($fh,$res);
$string = $db->qarray(
"SELECT field32 FROM business_db WHERE id='{$res}'"
);
$new = "";
foreach($string as $s){
fwrite($fh,$s);
}
這傷害了我的眼睛... –
你在那裏做什麼? 'mysql_result'不返回字符串,那麼計劃是什麼? –
http://ca.php.net/manual/en/function.mysql-result.php它返回一行的結果。我想輸出我的結果存儲在$字符串到一個文件。 –