次のスキーマを持つデータベースにテーブルがあります。
"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>";
?>
ファイルを呼び出すと、このエラーが発生します」
"; 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"; ?>
問題なくフォームを介してテーブルにデータを追加できます。
何か案は?
ありがとうございました