How would you open a connection to a MySQL database server?
Which MySQL function would you use to select a database?
Which function would you use to send a SQL query to a MySQL database?
What does the mysql_insert_id() function do?
How would you declare an auto-increment field for a SQLite database?
Which function would you use to execute a SQL statement with the SQLite functions?
Which object is returned by DB::connect()?
How would you get a unique id for a row using the PEAR::DB package?
You can connect to a MySQL daemon using the mysql_connect() function.
The mysql_select_db() function attempts to select a database.
You can send a SQL query to the database server with the mysql_query() function.
mysql_insert_id() returns the value of an automatically incrementing field after a new row has been added to a table.
You can define an auto-increment field in a SQLite database by declaring a field as INTEGER PRIMARY KEY in a CREATE statement, like so:
CREATE TABLE thing ( id INTEGER PRIMARY KEY, name VARCHAR(100) );
The sqlite_query() function executes a SQL statement.
DB::connect() returns an object of type DB_common. This is always a child implementation specific to a database application.
The DB_common::nextID() method can be used to get a unique id, as shown here:
$id = $db->nextId('sequencename');