hello good day to everone, anyway im a newbie on php, and im creating a website which requires sign up or registration before entering the site, anyway Im using MySQL for back-end(database). hope u can help me guys, thanks in advance… heres my code but it has an error " Warning: Wrong parameter count for mysql_connect() in C:\wamp\www\webtry\check_signup.php on line 28
Cannot connect to database "
This is my code :
<html>
<title>
</title>
<head>
<link rel=“stylesheet” type=“text/css” href=“layout.css” />
<link rel=“shortcut icon” href=“clown.png” />
</head>
<body>
<?php
$host= “localhost”;
$username="";
$password="";
$age="";
$fname="";
$lname="";
$id= “”;
$db_name=“test”;
$tbl_name=“member”;
mysql_connect("$host", “$username”, “$password”, “$fname”, “$lname”, $age) or die(“Cannot connect to database”);
mysql_select_db("$db_name") or die (“Cannot select DB!”);
$myfirstname=$_POST[‘myfirstname’];
$mylastname=$_POST[‘mylastname’];
$myage= $_POST[‘myage’];
$myusername=$_POST[‘myusername’];
$mypassword=$_POST[‘mypassword’];
$check= "SELECT * FROM $tbl_name WHERE username= ‘$myusername’ and password= ‘$mypassword’ AND
fname= ‘$myfirstname’ AND lname= ‘$mylastname’ AND age= $myage ";
$qry= mysql_query($check) or die (“Could not match”);
$num_rows = mysql_num_rows($qry);
if($num_rowns !=0)
{
echo “Sorry, the username $myusername is already taken.”;
exit;
}
else
{
$insert = mysql_query(“INSERT INTO $tble_name VALUES(‘NULL’,’$myusername’, ‘$mypassword’, ‘$myfirstname’, ‘$mylastname’, ‘$myage’”)
or die(“Could not insert data”);
}
?>
</body>
</html>