Error in accessing database from MS Access using php
Posted: Tue Nov 01, 2011 2:50 am
I am trying to access the MS Access database in a php page. here is the code. I am getting an error Parse error: syntax error, unexpected T_STRING in C:\wamp\www\viewresult.php on line 23. Please help me Guys
23rd line is $admission number=odbc_result($rs,"admission number");
Code: Select all
<?php
$conn=odbc_connect('result','','');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM result";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<table><tr>";
echo "<th>admission number</th>";
echo "<th>student name</th></tr>";
echo "<th>marks</th></tr>";
echo "<th>result</th></tr>";
while (odbc_fetch_row($rs))
{
$admission number=odbc_result($rs,"admission number");
$student name=odbc_result($rs,"student name");
$marks=odbc_result($rs,"marks");
$result=odbc_result($rs,"result");
echo "<tr><td>$admission number</td>";
echo "<td>$student name</td></tr>";
echo "<td>$marks</td></tr>";
echo "<td>$result</td></tr>";
}
odbc_close($conn);
echo "</table>";
?>