PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
$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"); };
?>
The email check doesn't work as it should, it says:
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
What am I doing wrong?
Thanks alot!
Last edited by hanzo on Tue Dec 20, 2005 2:07 pm, edited 1 time in total.