943,722 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 18731
  • PHP RSS
Jul 13th, 2006
0

Call to undefined function mysql_connect()

Expand Post »
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.
Similar Threads
Reputation Points: 33
Solved Threads: 19
Nearly a Posting Virtuoso
mikeandike22 is offline Offline
1,496 posts
since May 2004
Jul 13th, 2006
0

Re: Call to undefined function mysql_connect()

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]
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Jul 14th, 2006
0

Re: Call to undefined function mysql_connect()

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.
Reputation Points: 33
Solved Threads: 19
Nearly a Posting Virtuoso
mikeandike22 is offline Offline
1,496 posts
since May 2004
Jul 15th, 2006
0

Re: Call to undefined function mysql_connect()

Is the MYSQL functionality being loaded in the PHP.INI that's being used?
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004
May 10th, 2009
0

Re: Call to undefined function mysql_connect()

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tanya_ivanova is offline Offline
1 posts
since May 2009
May 11th, 2009
0

Re: Call to undefined function mysql_connect()

Reputation Points: 16
Solved Threads: 48
Posting Whiz
BzzBee is offline Offline
327 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: HELP:quiz management system
Next Thread in PHP Forum Timeline: Dates in drop down box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC