Jump to content

Help PHP V ODBC


westminster

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.