Cemetery Posted September 27, 2008 Share Posted September 27, 2008 Im an building a simple login page and when i hit submit i get this Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\loginck.php on line 5 this is the code i have to far <?php $username = "root"; $password = "test"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("first_test",$dbh) or die("Could not select first_test"); $result = mysql_query("SELECT id, first_name,surname FROM people"); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { print "ID:".$row{'id'}." Name:".$row{'first_name'}." ".$row{'surname'}."<br>"; } mysql_close($dbh); ?> Quote Link to comment Share on other sites More sharing options...
corbin Posted September 27, 2008 Share Posted September 27, 2008 http://www.phpfreaks.com/forums/index.php/topic,95378.0.html Quote Link to comment Share on other sites More sharing options...
Cemetery Posted September 30, 2008 Author Share Posted September 30, 2008 Still not working properly. I have: In the php.ini-recommended file changed extension_dir = "C:\php\ext" uncommented extension=php_mysql.dll, extension=php_mysql.dll I also deleted all instances of libmysql.dll except the one in c:\PHP and then copy and pasted the one from the php folder and placed it into C:\Windows\System32 And i'm still getting the same errors. I've also been searching the web about this issue and i found alot of cases with this issue. Has there been any more updates for this problem? Quote Link to comment Share on other sites More sharing options...
Chicken Little Posted September 30, 2008 Share Posted September 30, 2008 You say the changes were made in the php.ini-recommended file. Did you make a copy of this file and name it php.ini? Quote Link to comment Share on other sites More sharing options...
Cemetery Posted September 30, 2008 Author Share Posted September 30, 2008 Well that is in my folder is this a file Php INI-Recommended Then PHP.ini INI-Recommended Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 30, 2008 Share Posted September 30, 2008 Do you mean that is what is shown when view your php folder in Windows Explorer? If so you have not correctly renamed the php.ini. Open the php.ini-recommended into notepad. Then go to File > Save As.. and type the following into the file name box: "C:\php\php.ini" (including the quotes). After click save. A php.ini file should be created in your PHP installation folder. Use this new file to configure PHP. I would recommend you to change a system setting which stop Windows from removing the file-extensions from file names. To do so open any Folder and go to Tools > Folder Options > View. Now Scroll down the list of Settings and uncheck the setting labelled "Hide extensions from known file types". Click Ok. Windows should now show files extensions along side filenames, eg filename.ext rather than just filename Quote Link to comment Share on other sites More sharing options...
Cemetery Posted September 30, 2008 Author Share Posted September 30, 2008 Nope still not working. Quick question am i suppose to edit the php.ini or the php.ini.INI-recommended? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 30, 2008 Share Posted September 30, 2008 the php.ini This is why you have to rename the php.ini-recommended to just php.ini Quote Link to comment Share on other sites More sharing options...
Cemetery Posted September 30, 2008 Author Share Posted September 30, 2008 ok that is what i thought but it is still not working Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 30, 2008 Share Posted September 30, 2008 Are you restarting Apache after making any changes to the php.ini? Quote Link to comment Share on other sites More sharing options...
Cemetery Posted September 30, 2008 Author Share Posted September 30, 2008 yes Quote Link to comment Share on other sites More sharing options...
Cemetery Posted September 30, 2008 Author Share Posted September 30, 2008 by this php.ini-recommended now copy this to the Windows folder and rename it to just php.ini. do u mean cop it to windows/system 32? Quote Link to comment Share on other sites More sharing options...
Chicken Little Posted October 1, 2008 Share Posted October 1, 2008 No. Both php.ini and php.ini-recommended will reside in the same place. Quote Link to comment 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.