Sanderc schreef:Kijk eens goed in dit topicIk weet niet waar je het hebt uitgehaald? Dus ook niet waar het bijgekomen is?

Sanderc schreef:Kijk eens goed in dit topicIk weet niet waar je het hebt uitgehaald? Dus ook niet waar het bijgekomen is?

$result = mysql_query("SELECT * FROM users WHERE username=$_POST[referal]");
$count_users = mysql_num_rows($result);
if ($count_users > 0) {
whatever je ermee wil doen
}else{
Whatever je dan wil doen
} Thommity schreef:Niet veilig. Zo is het beter:[COLOR= #0000BB]<?php $result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username=$_POST[referal]"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]<?php
$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username="[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]referal[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]