lundi 5 octobre 2015

SQLite version of the mysql function

i would like make a simple web services with php-sqlite. i have found an nice starting point example, but i need an help to modify the connection from mysql to sqlite. Im rusty with php. So how can I change the code posted below to reflect sqlite connection?

class API extends REST
{
public $data = "";
const DB_SERVER = "localhost";
const DB_USER = "Database_Username";
const DB_PASSWORD = "Database_Password";
const DB = "Database_Name";

private $db = NULL;

public function __construct()
{
parent::__construct();// Init parent contructor
$this->dbConnect();// Initiate Database connection
}

//Database connection
private function dbConnect()
{
$this->db = mysql_connect(self::DB_SERVER,self::DB_USER,self::DB_PASSWORD);
if($this->db)
mysql_select_db(self::DB,$this->db);
}  

Aucun commentaire:

Enregistrer un commentaire