Jump to content

Php with MsAccess


jeeva

Recommended Posts

Is there any major difference between mysql and Ms Access  to be used with php?

 

Not really, but it depends what you mean. You use the odbc] interface to connect to access. It has much of the same functionality as the mysql* interfaces. Access's sql is a little different in places as well but this has nothing really to do with php.

Link to comment
https://forums.phpfreaks.com/topic/37867-php-with-msaccess/#findComment-181304
Share on other sites

mysql

<?php
$con =  mysql_connect("server","username","password");
mysql_select_db("database");
mysql_query("SELECT * FROM items");
?>

 

ms access(only on MS Windows server does not mater)

 

<?php
$con = new COM("ADODB.Connection");
// MS Access 2003 or before
$db = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("./db.mdb").";";

// MS Access 2007
//$db = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=". realpath("./db.accdb").";";

$db_conn->open($db);
$rS = $db_conn->execute("SELECT * FROM items");
$f1 =  $rS->Fields(1);
$f2 =  $rS->Fields(2);
$f3 =  $rS->Fields(3);
$f4 =  $rS->Fields(4);
$f5 =  $rS->Fields(5);
$f6 =  $rS->Fields(6);
?>

Link to comment
https://forums.phpfreaks.com/topic/37867-php-with-msaccess/#findComment-181307
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.