I apologize if this is somewhere in these forums, but I tried to look for it first.
I'm doing something where I need to enter ID numbers, but I don't want the same one twice. Furthermore, I would like for the page to give an error if this happens.
I don't entirely know how to do this, but I've read around and found stuff like
mysql_query("SELECT COUNT(*) FROM <table> WHERE <column>"). This is great and all, but if I try to save that value to a variable, like
$counter=mysql_query("SELECT COUNT(*) FROM <table> WHERE <column>"),
I don't get a number, such as 0 or 1 or anything that I want, I get a Resource #3 or something along those lines. All I want is to be able to check the database against the ID given in a form to see if it is there. If it is, I wanna go to a page that says "This ID is already in use, please try again", otherwise, go to a page that says "successful." I know how to do all of this except to able to check for the duplicate.
If I were to get a number, then I could just do an if($counter=="0")........for my other pages.
Sorry the post was so long! I'm just very frustrated right now. Any help would be awesome! Thanks!