Board index   FAQ   Search  
Register  Login
Board index php forum :: Database Other Database Engines

How to access database from MS Access using php

Do you have questions regarding other database enginges (not MySQL) -- ask here!

Moderators: macek, egami, gesf

How to access database from MS Access using php

Postby ersahil » Mon Oct 31, 2011 11:36 pm

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

<?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>";
?>
ersahil
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Oct 31, 2011 11:25 pm

Re: How to access database from MS Access using php

Postby ersahil » Mon Oct 31, 2011 11:38 pm

23rd line is $admission number=odbc_result($rs,"admission number");
ersahil
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Oct 31, 2011 11:25 pm


Return to Other Database Engines

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron