[SOLVED] Checking if user already exists????

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!

Moderator: General Moderators

Post Reply
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

[SOLVED] Checking if user already exists????

Post by ddragas »

Why this script doesnt work?
I get warning:
"Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0"

and script is:

Code: Select all

<?php
session_start();
?>
<?php


include("con_db.php");

mysql_select_db("iznajmljivaci") or
die("Nije moguæe pristupiti bazi podataka");

/* provjera dali ulaz veæ postoji */
$sel = "SELECT email FROM iznajmljivaci where email = '$email'"; 
$quer = mysql_query($sel); 
$row = mysql_fetch_array($quer); 
$email = $_SESSION['email'] = $row["email"]; 

// check if email exist

if ($email == "") { 

//insert into database;

} else { 

echo "e-mail already exists";
}
?>

?>
CerIs
Forum Newbie
Posts: 22
Joined: Sat May 29, 2004 9:20 am

Post by CerIs »

Not sure about the error but i you could try something like this instead:

Code: Select all

<?php if(mysql_result(mysql_query("SELECT COUNT(*) FROM affmembers WHERE Username='$Username_f'"), 0))
die (header("Location: affiliates2.php?Error=Sorry this username has allready been taken, please try another."));


?>
Thats one i use and it works pretty well.
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Thank you
Post Reply