View Full Version : PHPDev: How do I access MySQL?

01-06-2007, 02:13 AM
I have phpdev working fine for php, but I am trying to set up a database now, and it seems like I remember setting up a password back when I installed it, but I have no idea what that was now.

How do I find out what it was, and what the other information is?


Len Whistler
01-06-2007, 07:32 PM
You don't need a password or user, leave those blank. Launch phpdev and click on start_here.htm > localhost/phpmyadmin to create your new database. To connect to the database I use this php code, the only change it needs is the DB_NAME, canada would be changed to your database name.

define ('DB_USER', '');
define ('DB_PASSWORD', '');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'canada');

$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db (DB_NAME);

When you upload your code to a server you will have to enter the DB_USER and DB_PASSWORD, which you will get when you setup the database, so make sure you write those down. phpdev has PHP Version 4.2.3, you might run into some problems with newer code.