ok think i got it, make unique key on username, then use this php to check for that error thing:
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
if (!mysql_select_db("nonexistentdb", $link)) {
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
}
mysql_select_db("kossu", $link);
if (!mysql_query("SELECT * FROM nonexistenttable", $link)) {
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
}
?>
so on return of this error message thing to the original file which posts the data to the db how do i then get it to throw a popup syaing something like "Sorry you have already entered the competition"