PDA

View Full Version : help needed


DeadGaze
12-11-2003, 08:08 AM
ok hehe i have a vouch system whit ipp saver and stuff
i have a code like thiss
$DB_site->query("INSERT INTO vouch (vouchlog,userid,dateline,script,ipaddress) VALUES (NULL,'$form[username]',".time().",'vouch.php','$ip')");

but now i want to let the vouch look if there is already the ip from a user and when there is he get a message that he already did it and when not he insert it and get forward to the vouch
i know it must before it whit else if but i cant find the code and didnt know it í
have tryed thiss code but that isnt working

$DB_site->query_first("SELECT ipaddress FROM vouch") {

can someone help me to find the correct code
Thanxss

Darkwaltz4
12-25-2003, 07:18 AM
$row = $DB_site->query("SELECT vouchlog FROM vouch WHERE ipaddress='$_SERVER[REMOTE_ADDR]'");

if(!$DB_site->num_rows($row)) {
//insert into table, does not currently exist
} else {
//message that it exists in table
}



is this what you want?