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

please fix the error
What is the error in the below code ???
Line number On/Off | Expand/Contract <?php

Material xxx does not exist in plant xxx
Dear All,

I am working for a steel project which is repetitive manufacturing.

Best way to check for end of a record and send it back to the first record
I'm hoping someone can help me out and explain the best way to accomplish this.

What I'm doin

$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown

newbie error
what is wrong with this code ?

<html>
<body>

<?

A rank users order by points
I want to make an insert from table 'rank' , with number (rank) from the cod blow, to fild users.ran

user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to

header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1

Converting RGB values to HEX
Code: <?PHP

$file_handle = fopen("colors/rgb.csv", "r");

wh

LOOPing Problem
Hello All!

The following code loops through the data and displays the data accordingly. My p

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