Jump to content

[SOLVED] mysql_connect()


rabmerab

Recommended Posts

Hi there,

 

After stangling to make php and apache server works ( success at last  :D), now I am having problem using mysql.

The installaion went with no problem. I can use it in console ( under dos ) with no problem but when I try to using it in php that's where I am craying for help. :(

Bellow is php script:

 

<?php

 

$conn = mysql_connect("somedomain", "some_user, "soem_passord") or

    die ("Hey loser, check your server connection.");

?>

 

and this is the HTMl output:

 

Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache group\Apache2.2\htdocs\connect.php on line 6

 

Any ideas please.

 

rabmerab

 

Link to comment
Share on other sites

Show us the stuff you type in for the parameters, except for password of course

 

Try something like this.

 

<?php
$conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($conn);
?> 

 

Also set error reporting on.

Link to comment
Share on other sites

Please bother to read the error message - "Call to undefined function mysql_connect()"

 

The mysql extension is not enabled in your php.ini. This is a common "first step" problem. There are literally hundreds of posts in this forum describing how to enable the mysql extension. Use the forum's search function and you will find the solution.

Link to comment
Share on other sites

 

 

I did manage to make it  works.

the steps with i did follow are :

copy

 

libmysql.dll

php5apache2.dll

php5apache.dll

php5ts.dll

php_mysql.dll

 

to C:\windows\system32

 

add

extension_dir = "C:\php\ext"

extension=php_mysql.dll

 

to php.ini

 

Thanks every 0ne

 

rabmerab :)

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.