Skip to content

Tag: database

Database Driver MySQLi Error

I am running Moodle test environment on Window Vista having PHP 5.2.10 and MySQL 5.1.36-Community. When I upgrade from Moodle 1.9.9 to 2.0, I am getting the following error. I also tried to change the dbtype=’mysqli’ in config.ini and still see same error. I would really appreciate if you can prov…

PHP MYSQL $row[$variable]

I am trying to work around with dynamic table creation and data fetching. I am trying to get the data using following code : But, I am unable to get any data back. I checked printing the query and running it in php my admin and its working as I want. But I guess variable in array might not be

PDO get the last ID inserted

I have a query, and I want to get the last ID inserted. The field ID is the primary key and auto incrementing. I know that I have to use this statement: That statement works with a query like this: But if I want to get the ID using this statement: I get this error: What am I doing wrong?

can not access to database in moodle

I am using moodle and I change location of my web site, but I am facing this error. My config.php is: And my error is: Error: Database connection failed. It is possible that the database is overloaded or otherwise not running properly. The site administrator should also check that the database details have be…

How to get database name in PDO?

Is there a function or constant within PDO that stores the database name (the testdb value) ? I did a var_dump on $dbh and cant find anything… Answer You could use the setAttribute() (essentially a key value pair) method to store the database name when you set it up initially, then use the getAttribute(…