Hallo to all, I have a problem on how to test an existing data from the database. . .I have this registration form which displays an error if the user inputs a username and emai address which already exist in the database. Please help me, I can't find any related problems which already been solved.
nagatron
0
Junior Poster in Training
Recommended Answers
Jump to PostPerhaps the following:
//get username $username='Bill Gates'; //validate $username=mysql_real_escape_string($username); //set the sql query $result=mysql_query('SELECT * FROM `table` WHERE `usercolumn`="'.$username.'"'); //check if it exists if (mysql_num_rows($result)>0) { //it exists } else { //it does not exist }
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.