0
我在mysql數據庫中有一個名爲revenue的表,我需要在表格中顯示錶格中的列和數據。到目前爲止,我只是在下面的代碼中回顯數據。幫助表示讚賞。從一個mysql表中顯示數據,使用php
<?php
include('adodb/adodb.inc.php');
echo 'To See existing records';
$db=NewADOConnection('mysql');$db->Connect("127.0.0.1", "vpp", "abcd", "vpp");
$sql="select * from revenue";
$result = $db->Execute($sql);
if ($result === false) die("failed2");
$records=array();
$count=$result->RecordCount();
echo "Total Records Found :".$count."<br>";
if($count > 0) {
for ($x=0;$x<$count;$x++) {
$offerId=$result->fields[0];
$affId=$result->fields[1];
$status=$result->fields[2];
$deduction=$result->fields[3];
echo "OfferId:".$offerId." and AffId:".$affId." with deduction %:".$deduction." status=".$status."<br>"; // Need this data to be dispalyed in a table
$rec=array("offerId"=>$offerId,"affiliate_id"=>$affId,"status"=>$status, "deduction"=>$deduction);
array_push($records,$rec);
$result->MoveNext();
}
}
?>
得到的結果格式化,這樣[SO問題](HTTP顯示在一個HTML表格://計算器。 com/questions/26463923/php-mysql-query-to-html-table-only-inserts-to-first-table-row)?還是我誤解了? – OldPadawan