connecting to db

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
rpidcock
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 1:08 am

connecting to db

Post 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.
sujithtomy
Forum Commoner
Posts: 46
Joined: Tue Mar 24, 2009 4:43 am

Re: connecting to db

Post by sujithtomy »

Hello,

is MySql Module installed in your PHP ??

check with

Code: Select all

echo phpinfo();
to see mysql installed and version.
rpidcock
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 1:08 am

Re: connecting to db

Post 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.
sujithtomy
Forum Commoner
Posts: 46
Joined: Tue Mar 24, 2009 4:43 am

Re: connecting to db

Post by sujithtomy »

Hello,

So i think you must install mysql.

Installing PHP and MySQL
Attachments
info_php.jpg
info_php.jpg (37.11 KiB) Viewed 476 times
rpidcock
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 1:08 am

Re: connecting to db

Post 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
Post Reply