Jump to content

Cannot figure out problem


Recommended Posts

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);
?>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.