Page 1 of 1

connecting to db

Posted: Wed Mar 25, 2009 1:12 am
by rpidcock
I'm using the following code from a tutorial trying to connect to a database but am getting an http 500 error.

$dbconn = mysql_connect("localhost","phpuser","!phpuser");
if (!$dbconn) {
die('Could not connect: ' . mysql_error());
}
mysql_query("SET NAMES 'utf8'");



http://www.netbeans.org/kb/docs/php/wis ... sson2.html

The link above is to the tutorial I'm working with.
Any ideas are appreciated.

Re: connecting to db

Posted: Wed Mar 25, 2009 2:48 am
by sujithtomy
Hello,

is MySql Module installed in your PHP ??

check with

Code: Select all

echo phpinfo();
to see mysql installed and version.

Re: connecting to db

Posted: Wed Mar 25, 2009 3:08 pm
by rpidcock
where within the phpinfo will I see the mysql installed and version info.

I've ran the phpinfo but do not see mysql installed or version info.

Re: connecting to db

Posted: Fri Mar 27, 2009 12:43 am
by sujithtomy
Hello,

So i think you must install mysql.

Installing PHP and MySQL

Re: connecting to db

Posted: Fri Mar 27, 2009 10:28 pm
by rpidcock
Okay....I knew I had installed mySQL but was not seeing the version info in the output of phpinfo();

I ran the PHP install again this time selecting the option for mySQL extension and all is working. I had previously tried re-running the PHP install but I selected full install (all options) and that created a problem.

Bottom line is that when running the install I pretty much accepted defaults with the exception of the extension for mySQL.

Richard