daniel.hegarty Posted August 1, 2011 Share Posted August 1, 2011 Hi there I have been pulling my hair all day about this problem. i am trying to connect to an access db and retrieve the records using the following. I have had to change the code from using mysql to odbc (don’t ask why) but I keep getting the following error. Fatal error: Call to undefined function mysql_query() in E:\kunden\homepages\11\d374587144\www\bigjigsrail.com\demo\phpsqlsearch_genxml.php on line 46 below is my code I know this is because it is trying to use mysql_query but I can’t find an alternative. Any help would be great. Thanks Daniel # INIT ################# // Absolute path of our mdb file $cur_dir = addslashes(dirname(__FILE__)); $db_file = $cur_dir . "\\Datastore\\cat.mdb"; $provider = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_file; // Establish the connection $conn = new COM("ADODB.Connection") or die("Cannot start ADO" . odbc_errormsg()); $conn->Open($provider); // Search the rows in the markers table $query = sprintf("SELECT ShopName, Latitude, Longitude, ( 3959 * acos( cos( radians('%s') ) * cos( radians( Latitude ) ) * cos( radians( Longitude ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( Latitude ) ) ) ) AS distance FROM Markers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 5", addslashes($center_lat), addslashes($center_lng), addslashes($center_lat), addslashes($radius)); $result = mysql_query($query); $result = mysql_query($query); if (!$result) { die("Invalid query: " . odbc_error()); } Quote Link to comment https://forums.phpfreaks.com/topic/243462-database-problems/ Share on other sites More sharing options...
the182guy Posted August 1, 2011 Share Posted August 1, 2011 Have a look at this: Connect to Access with PDO. Quote Link to comment https://forums.phpfreaks.com/topic/243462-database-problems/#findComment-1250135 Share on other sites More sharing options...
daniel.hegarty Posted August 1, 2011 Author Share Posted August 1, 2011 Sorry but i dont see how that helps. i useless at php. is the problem with the php.ini? Dan Quote Link to comment https://forums.phpfreaks.com/topic/243462-database-problems/#findComment-1250141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.