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).

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

Simple Variable Question
Hi everyone.... again,

I am really getting into php still. Learning more every day. I love it

PHP Include not working
The website is http://www.grlistingservices.com

The code block is as follows:

<

Help to integrate whois Domain Details to website
Hi,

can i know is their any php script r methods to add domain details to my website.

Need help with basic sql
Hi,

I am using oracle 10g, and having some small doubts related to sql , here goes the si

Change Age automatically
hi guys . im new to php , is it possible to change age value in mysql automatically when year change

some query on multilingual website
Hi all,

Which is the simplest and easiest method to make a website multilingual,
is it put

php/mysql auto logout after 2 hour and reset password
Hi all,

This I hope will make sense. I've the following code which when a user logins in, cr

Array becomes unset by itself?
Hi,

I have a bit of experience with PHP but not extensive. It seems I cannot store any items

Calander Basic Spript help
hi, just starting out with PHP and have the following script:

<?php
//This gets t

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

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