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

Passing PHP variables from one page to another
Hello-

I'm having trouble figuring out how to transport a variable from one php file to anoth

Data storage spaces in varchar2
Trying to understand what's happening.
I am selecting a value from a table that is defined as c

Simple code help with redirects
I am trying to figure out a redirect script that detects if the browser is IE 7 and if it does, redi

Hashing?
Hi, I was hoping to take a string value then convert it - consistently - across each of our pages in

How can use this array as a key?
Say I have this array for example:


print_r($array);

Prints:
Code: [Select]Array

get url?
how do i get the url of the page i'm currently on, on my website.. i think its get header.. how do i

Call db table from any PHP file
Hi,

I want to be able to call a database table that will be setup in another file called init

Login logout link help
Hi all,

Im new to php and Im having trouble creating a login/logout link for my page that dis

Run function every 5 mins ??
I have a function PostMessage()

How can I run it every 5 mins ??

Expandable Post Code
Hi,

Hope you can help. Which currently I haven't upgraded to connect to a mysql server, so i

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