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

Using the $_GET variable to view certain records
Hello,

First let me explain my problem, I have 2 pages the first page pull a list of Guide ti

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

How to display objects in a row
I have 7 codes that i want to display in a row one next to another.
The first is {$ads->ad

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

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

The code block is as follows:

<

why is it over writing
Code: $filepaths[] = $_FILES['new_image'];
foreach ($filepaths as $filepath)
{
$imagename =

Only add new information from XML to MySQL
What I am doing, is taking a xml file, and adding the values to a database. However, what I want to

Mass activity scheduling
Hi experts,

Im facing some problems to deal with mass activity jobs.
When I run some

! = ''
In the following 'IF' statement if v_ompcat = PU for example then Oracle equates that 'IF' statement

type check while uploading
Hi Everyone,

How can I check the exact type of a file while uploading on my site?

Here

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