(Or maybe, Access databases are to be used with .asp pages only, being Microsoft almighty software, don't know).
Anyway, using PHPRunner, I uploaded a set of scripts to use an Access database, I did try it locally (on my system, using EasyPHP), and it worked perfectly.
However,when I uploaded everything and then tested it in my browser, I was greeted with the following:
Quote
Fatal error: Call to undefined function odbc_connect() in /home/mrdee/public_html/DBtest/include/dbconnection.php on line 9
Below is the code to the offending file, I changed the value of "$uid" form blank ("") to "root", as, on my system, the username "root is required, and no password is set.
(Doesn't matter disclosing that here, it is only for test purposes.
However, I suspect (could be totally wrong, of course), that my server does not recognise the driver for Access databases and it has trouble with the variable $OCDBString.
Am I right or wrong?
Can an Access database be used on my hosting just like a MySQL database is used?
Who can enlighten me?
Thank you in advance for any advice.
<?php
function db_connect()
{
global $ODBCString;
$uid="root";
$pwd="";
$conn = odbc_connect($ODBCString,$uid,$pwd);
if (!$conn)
{
trigger_error(db_error(), E_USER_ERROR);
}
return $conn;
}
function db_close($conn)
{
return odbc_close($conn);
}
function db_query($qstring,$conn)
{
global $strLastSQL,$dDebug;
if ($dDebug===true)
echo $qstring."<br>";
$strLastSQL=$qstring;
if(!($rs=odbc_exec($conn,$qstring)))
trigger_error(odbc_error(), E_USER_ERROR);
odbc_binmode($rs,ODBC_BINMODE_RETURN);
odbc_longreadlen($rs,1024*1024);
return $rs;
}
function db_exec($qstring,$conn)
{
global $strLastSQL,$dDebug;
if ($dDebug===true)
echo $qstring."<br>";
$strLastSQL=$qstring;
return odbc_exec($conn,$qstring);
}
function db_pageseek(&$qhandle,$pagesize,$page)
{
db_dataseek($qhandle,($page-1)*$pagesize);
}
function db_dataseek(&$qhandle,$row)
{
$i=0;
while($i<$row)
{
odbc_fetch_row($qhandle);
$i++;
}
}
function db_fetch_array(&$qhandle) {
return odbc_fetch_array($qhandle);
}
function db_fetch_numarray(&$qhandle) {
$row=array();
odbc_fetch_into($qhandle,$row);
return $row;
}
function db_closequery($qhandle)
{
@odbc_free_result($qhandle);
}
function db_error() {
return @odbc_errormsg();
}
function db_numfields(&$lhandle) {
return @odbc_num_fields($lhandle);
}
function db_fieldname(&$lhandle,$fnumber)
{
return @odbc_field_name($lhandle,$fnumber+1);
}
?>
Edited by moderator, 21 May 2012 - 10:54 AM.
To be put in codes,not in quotes















