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

How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and

There was a problem with the request. (Code: 0)
Any Idea what could cause this? I get it randomly at best. But with both IE and FF. It derives from

Wierd echo error?
Hi, i got the most wierd php error ever and i don't know why..
Code: echo "<t

list files from folder, only one for each date
I have many files in a folder and wish to only list one of each date

these are the file names

Dynamically set AccordianPane Header
I have an accordian on my master page. I'd like to be able to dynamically change the header on diff

update sql when refresh - php
hi
I have made a table (attachement)

the users can update the sql database using + or x bu

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

IP Logger for Voting Script
Can anybody help me place an IP logger into my voting script?
I know that maybe it is not as secu

Error in Configure System Landscape Directory phase
Hi

We are getting the error in Configure SLD phase ( 41 of 44 phase).

Please f

Problem with coding MySQL query
I'm having heaps of trouble getting one of my PHP/MySQL queries to work for some reason (and the fun

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