Jump to content

why wouldn't this work?


kleenhead

Recommended Posts

it should echo the first column of the first row of an access database. but nothing happens.

 

<?

$db = "box_of_items.mdb";

$dbdir = "D:/box/b523945/xmu/";

$query = "SELECT * FROM tblItems";

 

function dbquery($query)  {

  $arr    = array();

  $connection_id = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$dbdir.$db");

  $result_id = odbc_exec($connection_id,$query);

  $x = 1;

  while (odbc_fetch_row($result_id))

{

    for ($y = 1; $y <= odbc_num_fields($result_id); $y++)

      $arr[$x][$y] = odbc_result($result_id,$y);

$x++;

  }

if ($x > 1)

return $arr;

}

 

    $arr = dbquery($query);

    echo $arr[1][1];

 

    odbc_close($connection_id);

?>

Link to comment
https://forums.phpfreaks.com/topic/193913-why-wouldnt-this-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.