我有一個數據庫表與這個模式:PHP文件不會列出在數據庫表中的行
"CREATE TABLE IF NOT EXISTS `call_log` (
`clid` int(6) unsigned NOT NULL AUTO_INCREMENT,
`medid1` int(6) NOT NULL,
`medid2` int(6) NOT NULL,
`patid` int(6) NOT NULL,
`dcode` varchar(25) NOT NULL,
`acode` varchar(25) NOT NULL,
`transp` varchar(10) NOT NULL,
`facid` int(6) DEFAULT NULL,
`date1` varchar(45) NOT NULL,
`time1` varchar(45) NOT NULL,
`reg-date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`clid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
正在使用此文件列出表:注意#的PHPconn.php包含日誌在DB
<?
include("PHPConn.php");
mysql_connect ("$host", "$user","$password") or die (mysql_error());
mysql_select_db ("$database");
echo "<table border=1 >";
echo "<tr>";
echo "<td><b>Clid</b></td>";
echo "<td><b>Medid1</b></td>";
echo "<td><b>Medid2</b></td>";
echo "<td><b>Patid</b></td>";
echo "<td><b>Dcode</b></td>";
echo "<td><b>Acode</b></td>";
echo "<td><b>Transp</b></td>";
echo "<td><b>Facid</b></td>";
echo "<td><b>Date1</b></td>";
echo "<td><b>Time1</b></td>";
echo "<td><b>Reg-date</b></td>";
echo "</tr>";
$result = mysql_query("SELECT * FROM `call_log`") or trigger_error(mysql_error());
while($row = mysql_fetch_array($result)){
foreach($row AS $key => $value) { $row[$key] = stripslashes($value); }
echo "<tr>";
echo "<td valign='top'>" . nl2br($row['clid']) . "</td>";
echo "<td valign='top'>" . nl2br($row['medid1']) . "</td>";
echo "<td valign='top'>" . nl2br($row['medid2']) . "</td>";
echo "<td valign='top'>" . nl2br($row['patid']) . "</td>";
echo "<td valign='top'>" . nl2br($row['dcode']) . "</td>";
echo "<td valign='top'>" . nl2br($row['acode']) . "</td>";
echo "<td valign='top'>" . nl2br($row['transp']) . "</td>";
echo "<td valign='top'>" . nl2br($row['facid']) . "</td>";
echo "<td valign='top'>" . nl2br($row['date1']) . "</td>";
echo "<td valign='top'>" . nl2br($row['time1']) . "</td>";
echo "<td valign='top'>" . nl2br($row['reg-date']) . "</td>";
echo "<td valign='top'><a href=edit.php?id={$row['id']}>Edit</a></td><td><a href=delete.php?id={$row['id']}>Delete</a></td> ";
echo "</tr>";
}
echo "</table>";
echo "<a href=new.php>New Row</a>";
?>
當我打電話的filel我得到這個錯誤」
"; echo ""; echo "Clid"; echo "Medid1"; echo "Medid2"; echo "Patid"; echo "Dcode"; echo "Acode"; echo "Transp"; echo "Facid"; echo "Date1"; echo "Time1"; echo "Reg-date"; echo ""; $result = mysql_query("SELECT * FROM `call_log`") or trigger_error(mysql_error()); while($row = mysql_fetch_array($result)){ foreach($row AS $key => $value) { $row[$key] = stripslashes($value); } echo ""; echo "" . nl2br($row['clid']) . ""; echo "" . nl2br($row['medid1']) . ""; echo "" . nl2br($row['medid2']) . ""; echo "" . nl2br($row['patid']) . ""; echo "" . nl2br($row['dcode']) . ""; echo "" . nl2br($row['acode']) . ""; echo "" . nl2br($row['transp']) . ""; echo "" . nl2br($row['facid']) . ""; echo "" . nl2br($row['date1']) . ""; echo "" . nl2br($row['time1']) . ""; echo "" . nl2br($row['reg-date']) . ""; echo "EditDelete "; echo ""; } echo ""; echo "New Row"; ?>
我可以將數據表通過表單機智添加信息豪特問題。
任何想法?
謝謝
最新錯誤? – Aris 2013-04-27 13:04:44
mysql_query已被棄用請使用mysqli或PDO – underscore 2013-04-27 13:06:44
我已添加Niels修訂現在錯誤是類似拉差錯,除了表格框架顯示。我想要做的就是列出表格中的所有行。謝謝你們所有的幫助 – user2326872 2013-04-27 13:32:46