Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Can't connect to MySQL

Status
Not open for further replies.

peterv12

Technical User
Dec 31, 2008
108
US
I'm trying to connect to a MySQL database, PROJECT1, using a PHP script. This works perfectly in OS X, but when I run this in Kubuntu Linux, the first echo statement executes, displaying "before link....", then nothing happens. It should display the "after link...." echo statement.
Code:
<?php
// CONNECTDB.PHP - Updated: Monday July 8, 2009 - 6:23 PM
echo "before link....";
//
[COLOR=red]$link = mysql_connect('127.0.0.1', 'peterv', 'password','PROJECT1');[/color]
//
echo "after link....";
if (!$link) {
   die ('Connect failed: ' . mysql_error());
   exit();
} else {
// select the database
   $db_selected = mysql_select_db('PROJECT1', $link);
   if (!$db_selected) {
      die ('Database Selection failed: PROJECT1 ' . mysql_error());
   }
}
If anyone can help me out, I'd appreciate it. (This was posted in MySQL board, but no replies, so I assumed it should have been posted here.)
Thanks,
Peter V.
 
I've posted some info on the mysql forum.
BTW 4 hours is not really a long time to post in another thread (some of us sleep or just do other things :)
 
ingresman, I understand. I posted over there because I thought this one might be the wrong place. I didn't know how to close this one, before opening that one. Sorry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top