phphunt Posted June 2, 2013 Share Posted June 2, 2013 Hello, I try to connect Mysql via php but get this : Call to undefined function mysql_connect() May I know how to fix this ? Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/ Share on other sites More sharing options...
cpd Posted June 2, 2013 Share Posted June 2, 2013 (edited) You've likely not included the MySQL extension in your php.ini file. That said, get away from mysql and use mysqli or PDO. The mysql extension will be removed in the next PHP release. Edited June 2, 2013 by cpd Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433637 Share on other sites More sharing options...
salathe Posted June 2, 2013 Share Posted June 2, 2013 The mysql extension will be removed in the next PHP release. No, it won't. Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433640 Share on other sites More sharing options...
phphunt Posted June 2, 2013 Author Share Posted June 2, 2013 (edited) you mean these : extension=php_mysqli.dll[php_MYSQLI] extension=php_pdo_mssql.dll[php_PDO_MYSQL] They are in php.ini. Edited June 2, 2013 by phphunt Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433642 Share on other sites More sharing options...
DaveyK Posted June 2, 2013 Share Posted June 2, 2013 You PHP supported mysqli and PDO mysql, but not mysql() itself. That means your php is set up looking forward, rather than using old outdated mysql() stuff. mysql_* is deprecated as of 5.3.x (I think) and you shouldnt use it. Instead either use mysqli or PDO mysql, which is exactly the same query but the PHP around that query is different (they are both OOP). If you have any questions regarding mysqli() or PDO mysql, we are here to help obviously. Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433659 Share on other sites More sharing options...
mac_gyver Posted June 2, 2013 Share Posted June 2, 2013 slightly off topic, but no more so than the form section it is in - what does this thread have to do with the forum section it is in - All that regex stuff you were never able to figure out. Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433660 Share on other sites More sharing options...
cpd Posted June 2, 2013 Share Posted June 2, 2013 No, it won't. Care to explain? I was under the impression it was going to be removed in the next major release? Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433663 Share on other sites More sharing options...
mac_gyver Posted June 2, 2013 Share Posted June 2, 2013 the mysql_ extension must be depreciated for a time before it is actually removed and it is only officially depreciated starting in php5.5 - https://wiki.php.net/rfc/mysql_deprecation Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433667 Share on other sites More sharing options...
cpd Posted June 3, 2013 Share Posted June 3, 2013 Just goes to show how long I've not used MySQL for. I thought it was already deprecated. Quote Link to comment https://forums.phpfreaks.com/topic/278681-call-to-undefined-function-mysql_connect/#findComment-1433779 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.