Check before inserting in DB ???


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

This is my code
---------------
if ( $_POST ['Submit'])
{{
$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

Select Rows as Columns..
is there a way to select COLUMN_NAME from user_tab_columns where table_name='TABLENAME';
and ha

how to export excel file in same server
My first post - php newbie, so appreciate your support.

I'm currently using headers to save w

CRM?
I think that's what they're called. Customer Management System? Anyway. Is there any good free ones

php calculate
this code echoes correctly the sum but the inserted result is 0??
Code: <?php
$TotalNum

PHP Redirecting
Hello everyone. Is there a way to redirect people to pages within a statement in PHP? Since there is

fwrite error
Hi All,
Does anyone know what is causing the error in this code?

Code: <?
$error

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

Problem with umlauts and UTF-8
Hello every1,

I'm creating my own little CMS at the moment and got some problems with the cha

Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag

Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to

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