Hi, I'm new in php and face some problem in mysql.

I want to check some data if it's remain on database. Example: in my form there are two form field. 1) url 2) name. So i want to check if session user have already this 'url' and 'name' in the database then it's must be show error message.

How do i do this. Anyone can please give me this solution.

Thanks.

Recommended Answers

All 4 Replies

You can take count of the desired field from DB.

$result = mysql( "select * from users where url='$url' and name='$name'" );
if (mysql_num_rows($result) > 0)
  echo "Error: User already in database";

Thanks for your reply @smantschef. But I want to check Individual session user has already this url and name. Then it's must be show a error message. How do i do this?

Lets see the code that you are working on and make it work.

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.