View Single Post

  #1 (permalink)  
Old 01-21-2004
Vinny Gullotta
 
Posts: n/a
Default need help with an IF statement

I have this code:


if (isset($_GET['un']) AND isset($_GET['ln'])){

$un = $_GET['un'];
$ln = $_GET['ln'];

$query = mysql_query("INSERT INTO users ( username, link ) VALUES ('$un',
'$ln')");

if(!$query) die("Invalid query: " . mysql_error());

$result = mysql_query("SELECT link FROM links WHERE ID=$ln") or
die("Invalid query: " . mysql_error());

$y = mysql_fetch_array($result);

$go_link = $y['link'];

header("Location: $go_link");

exit();

}else{
echo "The required criteria was not found in the link.";

}




I need to write an IF statement that will only add $un and $ln to the table
users if the last one added was not the same username as this one (if it's
the same link, that's ok). For the ELSE part, it should still forward them
on to $go_link. Can anyone help? Everything I have tried seems to break
everything, and it's getting late and I'm not thinking too clearly.
Thanks in advance,
Vinny


Reply With Quote