I want to populate the datas in a table form using php. im getting the output but its shows
Use of undefined constant classid - assumed 'classid'
And is it possible for me to add columns and store these values in new table?
Here is my code:
<html>
<head>
<title>grade1</title>
</head>
<body>
<table border="1" cellspacing="1" cellpadding="1" width="200" height="200">
<tr>
<th>classid</th>
<th>studentid</th>
<th>teacherid</th>
<th>locid</th>
<th>date</th>
<th>flag</th>
<th>comments</th>
</tr>
<?php
$host = "localhost";
$user = "root";
$pass = "";
$dbname = "my_attendance";
$prefix = "";
$dbcon = mysql_connect($host, $user, $pass) or die("not connected");
mysql_select_db($dbname, $dbcon) or die("not selected");
$query = "(SELECT a.classid, a.fname, b.teacherid, c.locid
FROM class_master c JOIN student_master a
ON c.classid = a.classid JOIN teacher_link b
ON c.classid = b.classid
WHERE c.classid = 'grade1' )";
$result = mysql_query($query);
while( $row = mysql_fetch_array($result))
{
echo "<form action=insertattend.php method=POST>";
echo "<tr>";
echo "<td>" . "<input type=text value=" .$row[classid]." </td>";
echo "<td>" . "<input type=text value=" .$row[fname]." </td>";
echo "<td>" . "<input type=text value=" .$row[teacherid]." </td>";
echo "<td>" . "<input type=text value=" .$row[locid]." </td>";
mysql_close($dbcon);
}
?>
</html>