Ik heb dit script:
Hoe kan ik maken dat als de naam al bestaat dat er een rode error komt met:
Deze naam komt al in de database voor, kies een andere naam.
<form method="post">
Wat is de website van de linkpartner<br />
<INPUT TYPE="text" NAME="naam" VALUE="" /><br />
Wat is de naam van de Website<br />
<INPUT TYPE="text" NAME="link" VALUE="" /><br />
Wat is de info van de Website<br />
<INPUT TYPE="text" NAME="info" VALUE="" /><br />
<INPUT TYPE="submit" NAME="submit" /><br />
</FORM>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO linkpartners (id, link, naam, info) VALUES (NULL, "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]info[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]" Succesvol linkpartner toegevoegd"[/COLOR][COLOR= #007700];
}[/COLOR]
?> Hoe kan ik maken dat als de naam al bestaat dat er een rode error komt met:
Deze naam komt al in de database voor, kies een andere naam.
