Skip to content
Advertisement

Tag: database

Database design: implementing several types of the same entity

I’m coding a Classified Ads web application. The application has several types of Ads: General ads(electronics, toys, pets, books…) Real estate (houses, apartments, terrains…) Vehicles (motocycles, cars, vans, trucks…) Each type has several common fields (id, title, description) and also some that are exclusive to its kind: General Ads (no exclusive fields) Real estate (area, type-of-property…) Vehicles (type-of-vehicle, cubic-capacity, kilometers…)

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 provide some suggestion to resolve this error. Thank you in

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 been correctly specified in config.php Answer Thanks

Completely arbitrary sort order in MySQL with PHP

I have a table in MySQL that I’m accessing from PHP. For example, let’s have a table named THINGS: things.ID – int primary key things.name – varchar things.owner_ID – int for joining with another table My select statement to get what I need might look like: SELECT * FROM things WHERE owner_ID = 99; Pretty straightforward. Now, I’d like users

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() later in your code to see

Advertisement