View Single Post
Old Jul 13th, 2006, 12:28 PM   #1
billpull
Newbie
 
Join Date: Jul 2006
Posts: 10
Rep Power: 0 billpull is on a distinguished road
Call to undefined function mysql_connect()

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.
billpull is offline   Reply With Quote