MySQL wrapper class problem
Moderator: General Moderators
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
I think this will be the last question...
In the PDO php.net manual, in the function list of PDO library, I don't see the PDO:close() function, that if it exists, it could be used to close connection?
So how do you close the connection with the PDO library?
In the PDO php.net manual, in the function list of PDO library, I don't see the PDO:close() function, that if it exists, it could be used to close connection?
So how do you close the connection with the PDO library?
Re: MySQL wrapper class problem
You don't really need to. Because PHP is designed to execute and die, it will close it for you.
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
odd, but I guess it can work...Celauran wrote:You don't really need to. Because PHP is designed to execute and die, it will close it for you.
Thanks
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
Ok, I am sorry but I have to ask this one more question.
When you create a database, where does the MySQL server saves the file?
Is it even possible to see? I mean when I open the MySQL Workbench, I don't seem to be able to see what database files have been created.
Any idea?
When you create a database, where does the MySQL server saves the file?
Is it even possible to see? I mean when I open the MySQL Workbench, I don't seem to be able to see what database files have been created.
Any idea?
Re: MySQL wrapper class problem
Usually /var/lib/mysql on *nix systems. Not sure about Windows. Should be in your my.cnf file.
Re: MySQL wrapper class problem
And it's not necessarily a separate file (or any file at all). InnoDB tables could be created in a shared tablespace, and this shared tablespace could live on a raw device. Granted, this setup is not all that common, and I don't think it's possible on Windows anyway.
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
Something came up:
This is the code I have so far in the wrapper class for PDO.
I only have made one thing differently for php.ini and that's to enable the following dll libraries as instructed by the php.net manual.
but now when I run my program I get these error SYSTEM ERROR messages popup:
Do I have to reinstall PHP?
This is the code I have so far in the wrapper class for PDO.
Code: Select all
class PDO_MySQL_Wrapper {
private $db = null;
private $dbhost = null;
private $dbport = null;
private $dbuser = null;
private $dbpass = null;
private $dbname = null;
public function __construct($dbname, $dbhost, $dbport, $dbuser, $dbpass){
$this->dbname = $dbname;
$this->dbhost = $dbhost;
$this->dbport = $dbport;
$this->dbuser = $dbuser;
$this->dbpass = $dbpass;
}
public function db_connect(){
$this->db = new PDO("mysql:dbname=".$this->dbname.";host=".$this->dbhost.";port=".$this->dbport, $this->dbuser, $this->dbpass);//mysqli_connect($this->dbhost, $this->dbuser, $this->dbpass);
if(!$this->db){
throw new RuntimeException("Error: Could not connect to database. Please try again later.");
} else return true;
}
public function db_create($table){
if(($table = trim($table))!== NULL){
$sql = 'CREATE TABLE '.$table;
if ($this->db->query($sql)) {
return true;
} else {
return false;
}
} else return false;
}
public function db_delete($table){
if(($table = trim($table))!== NULL){
$sql = 'DROP TABLE '.$table;
if (mysqli_query($sql)) {
return true;
} else {
return false;
}
} else return false;
}
Code: Select all
extension=php_pdo.dll
extension=php_pdo_firebird.dll
extension=php_pdo_informix.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
but now when I run my program I get these error SYSTEM ERROR messages popup:
Code: Select all
the program can't start because fbclient.dll is missing from your computer. Try reinstalling the program to fix this problem.
The program can't start because OCI.dll is missing from your computer. Try reinstalling the program to fix this problem.
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
I fixed it...the thing was that I was loading all the dll files as suggested from the installation instruction from php.net, but they all say, to load only the necessary, so I went back to the php.ini file and ; commented out some extensions and that fixed the problem.
Now I have to read carefully what I read about this sort of thing.
Now I have to read carefully what I read about this sort of thing.
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
I didn't quite fix it...I am still missing the php_pdo.dll file.
My php installation is from web platform installer...why is missing the file is beyond me.
I tried downloading php from php.net to see if that copy has the dll file but it does not.
My php installation is from web platform installer...why is missing the file is beyond me.
I tried downloading php from php.net to see if that copy has the dll file but it does not.
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: MySQL wrapper class problem
follow this post for the answer: viewtopic.php?f=1&t=140657