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
https://forums.phpfreaks.com/topic/102106-solved-mysql_connect/
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
https://forums.phpfreaks.com/topic/102106-solved-mysql_connect/#findComment-522691
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
https://forums.phpfreaks.com/topic/102106-solved-mysql_connect/#findComment-522768
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
https://forums.phpfreaks.com/topic/102106-solved-mysql_connect/#findComment-522941
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.