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

IF STATEMENT HELP
Hi
i have created a calendar from a table:

Code: Calendar: October 2009
<table w

default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?

Cannot Connect to Database
I am writing an application to do annual reviews. I cannot get my script to work. Whenever it runs I

problem when runing a funciton
I am trying to connect to database using a funciton in a functions.php

<?php
funct

order by date not ID number help php
I am trying to orginize the following code to order by date not id number.
any help would be grea

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

php unable to sent email
Hi, guys, I try to send a email through php but unfortunately the mail unable to sent. Here is my co

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

Please Help my PHP Dating Function.
Hi everyone!

Well here is my code that displays this:

It works wonderful.


sapgui f4 help last search
I know this has to be simople. One user (maybe more) does not have the "last search saved" from the

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