Cykon Posted September 2, 2009 Share Posted September 2, 2009 I recently decided to take php under my belt after having background knowledge from a few other coding languages. I am currently toying around with SQL queries and such. -My Apache server is working -PHP is installed and working -I can access my MySQL server via Navicat Now no matter what I do, I can not get the php script to use an SQL command, I have tried quite a few different sample scripts, this one being the newest (From one of the documentations on mysql commands for PHP) <?php $host = "takenout"; $username = "takenout"; $password = "takenout"; $link = mysql_connect($host,$username,$password); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?> It does not output either messages when I go to the test page, but if I add a simple text line with echo at the top, it will output that specific message Now I have a strong feeling that the problem does not lie in this (or the other) code(s)... but if "other" php commands work... my apache server works... and I know for sure my mysql server is up... what is the problem! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/172782-very-simple-sql-usage/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 2, 2009 Share Posted September 2, 2009 The php mysql language extension is not enabled. A) You should set error_reporting to E_ALL and display_errors to ON in your php.ini to get php to help you. Stop and start your web server to get any change made to php.ini to take effect and check using a phpinfo(); statement that the settings were actually changed. The is likely a fatal runtime error concerning non-existent mysql_xxxxx functions. You will save a large amount of time learning php, developing any php code, and debugging any php code with these two settings set as indicated. B) There are instructions posted all over on how to enable the mysql extension. If php is installed correctly, you should only need to uncomment the extension=php_mysql.dll line in the correct master php.ini and stop and start your web server. Quote Link to comment https://forums.phpfreaks.com/topic/172782-very-simple-sql-usage/#findComment-910689 Share on other sites More sharing options...
Cykon Posted September 2, 2009 Author Share Posted September 2, 2009 Thanks for the response, I had the first two things already in, but the third I had to enable... I assume I move php_mysql.dll into my system32 folder? Well... I tried it restarted my server and now it crashes when I try to run a mysql command >.<* (before it was giving a command not found error) Quote Link to comment https://forums.phpfreaks.com/topic/172782-very-simple-sql-usage/#findComment-910721 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.