|
| Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more. |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Posts: n/a
|
mysql_connect()
I just installed mysql4.1.8 and php 5.03 on windowxp. I made a simple code to connect to mysql server, but I didnot work.Here is the error message and the code:
Fatal error: Call to undefined function mysql_connect() in d:\Inetpub\wwwroot\mysqltest.php on line 4 <html> <head> <body> <?php $linkID = mysql_connect("localhost","root","911"); if ($linkID != FALSE) { echo 'successfully';} else { echo 'failed'; } mysql_close($linkID); ?> </body> </html> |
|
|
#2 |
|
Posts: n/a
|
Look at your php info page and see if mysql is enabled:
Code:
I don't think mysql enabled by default in php5, not sure about that... |
|
|
#3 | |
|
Posts: n/a
|
sure enough...
Quote:
If you don't plan on running your scripts from a powweb server in the near future... you should use the mysqli extension instead of mysql. |
|
|
|
#4 |
|
Join Date: Jul 2004
Location: West Coast
Posts: 120
Reputation: 5
|
Boy, howdy, I know exactly the problem you're facing. =) I recently upgraded to PHP 5 and suffered the same issues. This are the changes I made to make them work:
In php.ini, I had to add these two lines: extension=php_mysql.dll extension=php_mysqli.dll (I'm setting it up so both the mysql_* functions and mysqli_* functions will work.) In the httpd.conf for Apache, I added these two lines: LoadFile C:/php/libmysql.dll LoadFile C:/php/libmysqli.dll I added them right before the line of: LoadModule php5_module c:/php/php5apache2.dll Then make sure you have a copy of libmysql.dll, libmysqli.dll, php_mysql.dll, and php_mysqli.dll in the correct directory. (I put all of them in my main php directory.) Also, this doesn't apply to you, but for anyone who unfortunately upgraded to PHP 5.0.2 on Windows--such as myself--an old API was bundled into that version and it'll display errors if you use the mysql_* functions. You'll have to pick up the PHP 5.0.3 version to get the new API. That little problem is ONLY associated with the Windows binary version of PHP 5.0.2, however, not other systems or versions. Happy trails! -- Ryan |
|
|
![]() |
| Thread Tools | Search this Thread |
|
|