Here's how my book has me connecting to my database:
define ('DB_USER', 'user');
define ('DB_PASSWORD', 'pword');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'user_test');
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)
or die ('Could not connect to MySQL: '.mysql_error());
mysql_select_db (DB_NAME)
or die ('Could not select the database: '.mysql_error());
It's working fine, but now I need to check my table to see if a specific primary key exists.
I stumbled upon the dba_exists function (not covered in my book) but the manuals I've seen only mention that it's used in conjunction with dba_open and don't give any examples.
dba_open is described as
resource dba_open ( string path, string mode, string handler [, ...] )
dba_open() establishes a database instance for path with mode using handler.
How do I reconcile the mysql_connect & mysql_select_db method that I've been taught in my book with the dba_exists? Is dba_open just another way of doing the same thing that mysql_connect & mysql_select_db do?
And what the heck is a string handler?