How to use php and sql to check if values match the ones in a table (for logins)


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

How would I code it that the script takes two variables that are passed to it (UserID and PIN), and checks the table to see if the PIN matches the one in the table. If it does it should assign the value "1" to a variable, if not a value "2".

This variable should then be passed back to the original calling script. (In a different PHP file).

Did you know?Explore Trending and Topic pages for more stories like this.
What I have so far is:
$ID = $_SERVER["argv"][1];
$ID = trim($ID);
$ID = ltrim($ID);

$PIN = $_SERVER["argv"][2];
$PIN = trim($STATUS);
$PIN = ltrim($STATUS);

$link = mysql_connect("localhost", "root", "passw0rd")
or die("Data base connection failed");
mysql_select_db("test")
or die("data base open failed");

I dont know the sql command to compare if the value passed on matches the current record.

Thanks
No comments posted yet

Your Answer:

Login to answer
227 Like 52 Dislike
Previous forums Next forums
Other forums

PHP If Else statement for breadcrumb
Hi

I am trying to use a PHP if else statement to display a breadcrumb link on wordpress

DYNPRO_FIELD_CONVERSION
Hi gurus,

I got a dump when I run one of my program. the dump is described below:

Display last record first.
I need some help how put the last record first and first record last.

Thanks

Code: &am

PHP Programming error. Please help!
Hi there,

Am making a website for a friend and have encountered a problem that i need fixing

Why doesn't this work? (SSH2)
This is my script:

Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);

Not loading image
When this function gets loaded it doesn't load the image just trying to figure out why.

Code:

Problem with HTTP Caching...?
Hi there, im trying to implement caching. But it doesn't always work.
I post it here because ther

php/xmlrpc class issue
I am working on xml-rpc in php to start with.

I have a class that only has variables defined

redirect standard error and assert (how to?)
How do you redirect standard error and assert?

---

(Why? I am creating an web app and

Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make

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