RSS Forums RSS

Call to undefined function mysql_connect()

Reply
Posts: 1,365
Reputation: mikeandike22 is an unknown quantity at this point 
Solved Threads: 17
Featured Blogger
mikeandike22's Avatar
mikeandike22 mikeandike22 is offline Offline
Nearly a Posting Virtuoso

Troubleshooting Call to undefined function mysql_connect()

  #1  
Jul 13th, 2006
I have seen a couple solutions to this problem but none have worked so far.

here is the error.
Fatal error: Call to undefined function mysql_connect() in C:\wamp\www\login.php on line 12

and the code
[PHP]<?php
// connect to the mysql server
$link = mysql_connect(localhost, root, admin)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
mysql_select_db(members)
or die ("Could not select database because ".mysql_error());

$match = "select id from members where username = '".$_POST['username']."'
and password = '".$_POST['password']."';";

$qry = mysql_query($match)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);

if ($num_rows > 0) {
setcookie("loggedin", "TRUE", time()+(3600 * 24));
setcookie("mysite_username", "$username");
echo "You are now logged in!<br>";
echo "Continue to the <a href=members.php>members</a> section.";
}
else {
echo "Sorry, there is no username: $username with the specified password.<br>";
echo "<a href=login.html>Try again</a>";
exit;
}
?>[/PHP]

now does it make a difference that I am using WAMP server instead of having just configured the php and mysql by hand. It worked yesterday now today nothing.
My Daniweb Blog: This,That, and Everything Else (Blog contest winner)

GetFirefox!
GetOpera!






AddThis Social Bookmark Button
Reply With Quote  
Posts: 294
Reputation: zippee is an unknown quantity at this point 
Solved Threads: 6
zippee's Avatar
zippee zippee is offline Offline
Posting Whiz in Training

Re: Call to undefined function mysql_connect()

  #2  
Jul 13th, 2006
Not sure this is the solution, but you do not quote the value for your variables.
[PHP]// connect to the mysql server
$link = mysql_connect('localhost', 'root', 'admin')
or die ("Could not connect to mysql because ".mysql_error());

// select the database
mysql_select_db('members')
or die ("Could not select database because ".mysql_error());[/PHP]
Ecommerce-Web-Store.com Building Your e-Business.
Reply With Quote  
Posts: 1,365
Reputation: mikeandike22 is an unknown quantity at this point 
Solved Threads: 17
Featured Blogger
mikeandike22's Avatar
mikeandike22 mikeandike22 is offline Offline
Nearly a Posting Virtuoso

Re: Call to undefined function mysql_connect()

  #3  
Jul 14th, 2006
yea it had something to do with my php setup so i reinstalled WAMP and just added in my backup files so pretty much i just replaced php and its extensions.
My Daniweb Blog: This,That, and Everything Else (Blog contest winner)

GetFirefox!
GetOpera!






Reply With Quote  
Posts: 491
Reputation: Puckdropper is an unknown quantity at this point 
Solved Threads: 20
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: Call to undefined function mysql_connect()

  #4  
Jul 15th, 2006
Is the MYSQL functionality being loaded in the PHP.INI that's being used?
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote  
Posts: 1
Reputation: tanya_ivanova is an unknown quantity at this point 
Solved Threads: 0
tanya_ivanova tanya_ivanova is offline Offline
Newbie Poster

Re: Call to undefined function mysql_connect()

  #5  
May 10th, 2009
Hi


I have been struggling with this for two days now !!!


And here is what the problem on my machine was:


In httpd.conf (in the conf folder of my Apache installation), the path to php.ini was incomplete, so i corrected it like so:


PHPIniDir "C:\Program Files (x86)\PHP\"


AND it miraculously worked !! (it is NOT to be believed had started thinkin this thing AINT made to be workin at all!!)


lol
Reply With Quote  
Posts: 204
Reputation: BzzBee is an unknown quantity at this point 
Solved Threads: 29
BzzBee BzzBee is offline Offline
Posting Whiz in Training

Re: Call to undefined function mysql_connect()

  #6  
May 11th, 2009
BzzBee
Website Design, Web Development, Internet Marketing Company, SEO & Online Promotion Solutions in Dublin,Ireland
http://www.etrix.ie/
http://www.etrixlimited.com/
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the PHP Forum
Views: 6712 | Replies: 5 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:12 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC