Check before inserting in DB ???


Posted on 16th Feb 2014 07:03 pm by admin

This is my code
---------------
if ( $_POST ['Submit'])
{{
Did you know?Explore Trending and Topic pages for more stories like this.
$username = $_POST ['usernm'];
$userpassword = $_POST ['userpw'];
}
/*insert data from the form into the db table*/

$querypost = mysql_query ("INSERT INTO users (usernm, userpw) VALUES ('$username','$userpassword')");
}
?>

How do I check before inserting whether that username and password is already inserted. I have an id assigned to every entry.
No comments posted yet

Your Answer:

Login to answer
158 Like 46 Dislike
Previous forums Next forums
Other forums

Get relative path from absolute path
How would one go about getting the relative path to a file from its absolute path?

exclude characters from counting?
Hello, I wanted to ask if you have a string like:
Code: $my_s='ASRGREGTGTR----REGREGRE+++RRRRRR..

printing links
Hi every1

i am connecting to a table in sql and the looping through with a while ($ var = my

Confusing Functions
So, I've been reading up on Functions and I like them! However, I need some help using variables in

Any meaningful project for a new C++ programmer?
I want to do some meaningful program, so I can help myself to learn

Assume I know the fol

Problem with shopcart code
Hello, I am having a bit of trouble being able to add a product to my shopcart. My mysql database i

IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h

Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<

PHP mail() rejected by SMTP
I'm currently working on a newsletter application which is installed on a windows 2003 server runnin

check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash