Jump to content

Archived

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

westminster

Help PHP V ODBC

Recommended Posts

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.

Share this post


Link to post
Share on other sites

×

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.