mysql_connect() error
Moderator: General Moderators
-
beckbapegeneral
- Forum Newbie
- Posts: 19
- Joined: Mon May 08, 2006 8:59 pm
mysql_connect() error
there is something wrong with my coding.. i am trying to create an connect in another .php file and to include it in my main .php file. but when i run in on the browser, there is a fatal error saying undefined call function mysql_connect(). anyone can help me please 
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: mysql_connect() error
If you are getting a call to an undefined function using mysql_connect then you do not have the mysql extension installed. Search these forums for how to install the mysql or mysqli extension by editing your php.ini file.beckbapegeneral wrote:there is something wrong with my coding.. i am trying to create an connect in another .php file and to include it in my main .php file. but when i run in on the browser, there is a fatal error saying undefined call function mysql_connect(). anyone can help me please
-
beckbapegeneral
- Forum Newbie
- Posts: 19
- Joined: Mon May 08, 2006 8:59 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
There should be plenty of threads and posts here about enableing extensions in php.ini. Do a quick search. It is usually something as simple as removing a semicolon from the front of a line in php.ini that looks like
Code: Select all
;extension=php_mysql.dll-
beckbapegeneral
- Forum Newbie
- Posts: 19
- Joined: Mon May 08, 2006 8:59 pm
guys.. i think there is some serious problem.. it is that i have uncommented the extensions=php_mysql.dll but the browser is now displaying this error to me
Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\opendb.php on line 2
PHP Warning: PHP Startup: Unable to load dynamic library './php_mssql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './php_msql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './php_mysql.dll' - The specified module could not be found. in Unknown on line 0
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Look at the errors you are getting. That means that PHP cannot find your extensions. Either the extension folder entry in php.ini is incorrect or the .dll's are not in that folder. One or the other.beckbapegeneral wrote:guys.. i think there is some serious problem.. it is that i have uncommented the extensions=php_mysql.dll but the browser is now displaying this error to me
Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\opendb.php on line 2
PHP Warning: PHP Startup: Unable to load dynamic library './php_mssql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './php_msql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './php_mysql.dll' - The specified module could not be found. in Unknown on line 0
-
beckbapegeneral
- Forum Newbie
- Posts: 19
- Joined: Mon May 08, 2006 8:59 pm
...
First of all, look at the PHP manual (http://www.php.net/manual/en/install.windows.php).
Secondly, the best thing to do is to install manually (with Apache): http://www.php.net/manual/en/install.windows.manual.php .
If you don't want to install again, just change your ext dir to extension_dir=C:\php\extensions, and check that the mysql ext is in the extensions dir.
Secondly, the best thing to do is to install manually (with Apache): http://www.php.net/manual/en/install.windows.manual.php .
If you don't want to install again, just change your ext dir to extension_dir=C:\php\extensions, and check that the mysql ext is in the extensions dir.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
beckbapegeneral,
You know, we may have been going about this all wrong. What version of PHP are you installing? Take a look at the Installation of extensions on Windows page of the PHP manual. It mentions extensions that are pre-built into the Windows distibution and how to install extensions that are not already in the distro.
You know, we may have been going about this all wrong. What version of PHP are you installing? Take a look at the Installation of extensions on Windows page of the PHP manual. It mentions extensions that are pre-built into the Windows distibution and how to install extensions that are not already in the distro.