steviecee
06-17-2005, 03:21 PM
i have a php odbc connect script for a ms access database as shown below
<?
$odbc = odbc_connect ('DIT_test.mdb', '', '') or die( "Could Not Connect to ODBC Database!");
if (function_exists(odbc_fetch_array))
return;
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;
}
?>
would this have to be changed to run a mysql database instread of the access one? i've tried using this for a mysql database with no luck, what would i need to change (apart from the database name!) if anything?
cheers
steve
<?
$odbc = odbc_connect ('DIT_test.mdb', '', '') or die( "Could Not Connect to ODBC Database!");
if (function_exists(odbc_fetch_array))
return;
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;
}
?>
would this have to be changed to run a mysql database instread of the access one? i've tried using this for a mysql database with no luck, what would i need to change (apart from the database name!) if anything?
cheers
steve