Jump to content
xisto Community
Sign in to follow this  
mrdee

Uploading Access Databases Do they work on Linux Hosting?

Recommended Posts

I was wondering if Linux Hosting restricts itself to the use of MySQL databses, or if it allows Access databases too.
(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:

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.

<?phpfunction 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
To be put in codes,not in quotes (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.