php on linux

Questions about programming languages and debugging
Post Reply
p99
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 291
Joined: 14 Oct 2006, 16:00
17
Location: Some hippy's van
Contact:

php on linux

Post by p99 »

Ok so I set up a server on linux and just took all my old stuff rom windows. When I try to connect to the database I get this upon page load:
Fatal error: Call to undefined function mysql_connect() in /home/p99/public_html/login.php on line 2

I am using the code:

Code: Select all

$dbh = mysql_connect("localhost", "asdf", "asdf");
if (!$dbh){
echo "FAIL";
}else{

//echo '<font color="green" size="1">Connected to DB</font><br>';

mysql_select_db("database", $dbh);}

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

hm, afaik you have to use ' instead of ", for example:

Code: Select all

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
what Linux distro is it btw? in Debian for example PostgreSQL is installed per default, not MySQL...

p99
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 291
Joined: 14 Oct 2006, 16:00
17
Location: Some hippy's van
Contact:

Post by p99 »

I'm on ubuntu. I found out that something wierd happend when I was setting up my server. Some sort of dependency thing when installing all the stuff (this is my first lamp server and i set up manually) must have uninstalled php-mysql. So I re-installed php5 and it works just find now.

Post Reply