MySQL - SELECT something IF (something is true) -


i've got database 3 columns, "id", "username", "password". i'm pretty new on sql (still learning :p ), , well, i'm not able idea working. android app. i've made login, enter login data , i've arranged working this:

i need sql query retrieves id of account if username , password matches. i've far:

<?php     $username = $_post['username'];     $password = $_post['password'];     $hostname = "-----";     $dbuser   = '-----';     $dbpass   = '-----';     $dbname   = '-----';      //connection database     $dbhandle = mysql_connect($hostname, $dbuser, $dbpass) or die("unable connect mysql " . \mysql_error() . "<br>");       //select db      mysql_select_db($dbname, $dbhandle) or die("unable connect db: " . \mysql_error() . "<br>");     $result = mysql_query("select usr_id if (username = '$username' , password = '$password') people") or die("error: " . mysql_error());     echo $result; ?> 

i know google friend, when i've tried find out, references gave me non-relevant information, or @ least, not relevant case.

so, anyway, thank time!

try using instead of if, so:

"select usr_id people username = '".$username."' , password = '".$password."'" 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -