php-mysql newbie problem

Started by
3 comments, last by jflanglois 18 years, 4 months ago
Hello all, i try to write my first php-mysql script but the php functions for mysql dont work.I wrote <?php $link = msql_connect('localhost', 'user', 'password'); ?> and the result in the browser is: Fatal error: Call to undefined function: msql_connect() in c:\phpdev\www\untitled-1.php on line. All the php functions that dont have to do with mysql work fine.Mysql from command prompt works also fine.I connected and played a little typing commands. I have the phpdev installed for apache-php-mysql.
Advertisement
You have to enable the mysql extension in php.ini. Look for the section called "Windows Extensions" and remove the semicolon in front of the line reading "extension=php_mysql.dll".
That said, you would be better off using the MySQLi extension.

[edit] And by the way, msql_connect() is not a MySQL extension function, it's an mSQL extension function. Change it to mysql_connect( ... )
[edit2] Also, I think you would have gotten more answers if you had posted in the Web Development forum. I'm sure a moderator can move this thread for you.


jfl.

[Edited by - jflanglois on December 18, 2005 2:51:53 PM]
You could shun the MySQLi functions, and go straight to either:

PDO - which is standard from PHP 5.1 onwards

Or

PEAR::DB which has been around for years.

Both will allow you to do more advanced DB stuff in a non database-specific fashion.

Mark
I enabled it.Thanks!!

Happy holidays everyone.
Quote:Original post by markr
You could shun the MySQLi functions, and go straight to either:

PDO - which is standard from PHP 5.1 onwards

Or

PEAR::DB which has been around for years.

Both will allow you to do more advanced DB stuff in a non database-specific fashion.

Mark


Or ADOdb. I completely agree with markr on this point. I haven't tried PDO, I'll have to give it a shot.


jfl.

This topic is closed to new replies.

Advertisement