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

present value of sequence?
Hi

Please help me to find out the present value of sequence?

Thanks

query help
Hi experts.

i have a table rep2 like this
PROD_COD ACCT_NO DUE_DAYS BALANCE

Not "Just Another" MMORPG - text based.
Hello,

I've been learning MySQL and PHP for the last 2-3 years.
Though, I've had long paus

PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a

getting most records by count
Code: [Select]<?php

$connect = mysql_connect("localhost","dam

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

Force download script not handling files with spaces properly
I have a regular old php force download script, uses this code:

Code: header("Cache-Cont

need help with this contact form
I made this form and I need it to read the data and write the data to a table and its not working ca

Send inserts to mysql thru port 80
Hi!

I have an application that must do some inserts in a mysql db. This db is behind a firewa

Preserving user-entered linebreaks
Hi, I'm building a web 2.0 thingy from scratch and I wanna display text which users input. It's all

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