Jump to content


Photo

Help PHP V ODBC


  • Please log in to reply
No replies to this topic

#1 westminster

westminster
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 03 May 2006 - 12:57 AM

hi anyone, im new to php however i am creating an application that uses php to connect to a ms access database via ODBC i have configured it together according to the instruction i read. i created a file called 'odbc.php' which contains the details. however i read that to link individual webpages to insert/update data in the database i have to write a php code for it in the page i want connected. Can anyone pls tell me what the code i need to put in is and where in the document page should i place the code? Also could you have a look at my odbc.php code to tell me if it's written correctly?

$odbc = odbc_connect ('project', '', '') or die('Could Not Connect to ODBC Database!');
?>
<?
if(!function_exists(''))
{
function odbc_fetch_array($result, $rownumber=-1)
{
if (PHP_VERSION > "4.1")
{
if ($rownumber < 0)
{
odbc_fetch_into($result, $rs);
}
else
{
odbc_fetch_into($result, $rs, $rownumber);
}
}
else
{
odbc_fetch_into($result, $rownumber, $rs);
}

$rs_assoc = Array();

foreach ($rs as $key => $value)
{
$rs_assoc[odbc_field_name($result, $key+1)] = $value;
}
return $rs_assoc;
}
}
?>

Pls help. i'll appreciate even the smallest help.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users