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

Looking for help on using joining mysql tables and php....
Does anyone have any good links to references on how to pull mysql data, through joining tables and

Running External Scripts
I am very new to PHP and am not even sure what I'm asking is possible. I have just installed mediaW

Rss feed question
Hi

My blog and my website are different. Am i able to take my rss feed
from my blog and p

Most basic form question ever?
Hello,

I want to use this snippet to make sure the fields in a form are ok before processing

Database 'Validation'
Hi everyone,
I'm trying to validate the password entered by the user with the password in the dat

Do something every fifth time?
I'm trying to write a loop, but I want it to do something different after every fifth instance. Like

php email checker
I am having alot of trouble finding info on how to do these email things. I need to do the following

How can you detect variable string in a massive string?
Ok guys, i need some help with this one.

I am going to be getting a large string, like 10-20

Call Screen statement Error
Dear Experts,

is there any setting that needs to be done before creating any dialog progr

Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and

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