Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Uploading Access Databases


No replies to this topic

#1 mrdee

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 810 posts
  • Gender:Male
  • Location:Slough (UK)
  • myCENT:90.63

Posted 03 March 2011 - 03:22 PM

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:

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





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users