TestClear

Author Topic: Re: Is there a good database library for PHP?  (Read 2108 times)

Offline coline

  • Supporter
  • **
  • Posts: 1
  • Karma: +0/-0
Re: Is there a good database library for PHP?
« on: October 14, 2015, 11:42:31 PM »

Is there a good database access class library for PHP?



« Last Edit: October 15, 2015, 12:30:39 PM by admin »

Offline ciko

  • Contributor
  • *****
  • Posts: 37
  • Karma: +3/-0
  • Gender: Male
    • phpenter.net
Re: Is there a good database library for PHP?
« Reply #1 on: October 14, 2015, 11:46:27 PM »
Try with some of this: Database Abstraction Layers PHP: http://framescripts.com/category/109/Database-Abstraction-Layers
« Last Edit: October 15, 2015, 12:31:03 PM by admin »

Offline alex

  • Global Moderator
  • *****
  • Posts: 77
  • Karma: +20/-0
Re: Is there a good database library for PHP?
« Reply #2 on: October 14, 2015, 11:59:55 PM »
I recommend to use ADOdb Library for PHP: http://phplens.com/lens/adodb/docs-adodb.htm

Sample Usage:

connect.php
Code: [Select]
<?php 
$host 
'localhost';
$dbuser 'root';
$dbpass 'testpass';
$dbname 'mytablename';
?>


file.php
Code: [Select]
<?php
include ('connect.php');
include (
'adodb/adodb.inc.php');
$DB ADONewConnection("mysql");
$DB->Connect($host,$dbuser,$dbpass,$dbname);
///////////////////////////////////////////////////////////////
$rd $DB->Execute('SELECT * FROM foo');
if(!
$rd)
 print 
$DB->ErrorMsg();
else
 while(!
$rd->EOF) {
  
$foo[] = $rd->fields;
  
//or $foo = $rd->fields['somefield'];
  
$rd->MoveNext();
 }
?>






« Last Edit: October 15, 2015, 11:00:51 AM by admin »