Author Topic: stored ms access query to be executed in php  (Read 1280 times)

0 Members and 1 Guest are viewing this topic.

Offline SairamTopic starter

  • Irregular
  • Posts: 2
    • View Profile
stored ms access query to be executed in php
« on: October 15, 2008, 07:19:25 AM »
I have created a query in MS Access database and named it as query1. I want to be able to execute this query through php code. I can understand the following code.

$conn=odbc_connect("mydb","root","pwd");
if($conn)
{
    $sql="select * from mytable";
    $row=odbc_exec($conn, $sql);
    $i = 0;
   
    while(odbc_fetch_row($row))
    {
        $i++;
        $name = odbc_result($row,1);
        $make = odbc_result($row,2);
        $model = odbc_result($row,3);       
     }
}

My question is how to give query1 to $sql or replace $sql in "$row=odbc_exec($conn, $sql);" with "$row=odbc_exec($conn, query1);"

I am new to programming in php. Please help me fix this problem. Your help is much appreciated. Thanks in advance.

Best Regards,
Sairam