in_array (probably very easy to solve)
Posted: Tue Dec 20, 2005 11:40 am
Hi everyone,
I'm a complete php noob
who has a problem...
I made the following code
The email check doesn't work as it should, it says:
Thanks alot!
I'm a complete php noob
I made the following code
Code: Select all
<?
$name = $_POST["name"];
$email = $_POST["email"];
$address = $_POST["address"];
$city = $_POST["city"];
$zip = $_POST["zip"];
$country = $_POST["country"];
$pass = $_POST["pass"];
$repass = $_POST["repass"];
//checking everything
//1 check password
if ( $pass != $repass ) {
die("passwords are not the same");
};
//2 check email address
mysql_connect ('localhost','USERNAME REMOVED BY HAWLEYJR','PASSWORD REMOVED BY HAWLEYJR')or die('Could not connect: ' . mysql_error());
mysql_select_db ('totallyj_ipod');
$query = "SELECT email FROM users WHERE activated = 1";
$result = mysql_query ($query);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row["email"], "\n";
}
if (array_key_exists($email, $row)) { die ("emailaddress is already used"); };
?>What am I doing wrong?Warning: array_key_exists(): The second argument should be either an array or an object in /home/totallyj/public_html/freegiftipod/register2.php on line 31
Thanks alot!