Pattern:
SELECT column_name(s)
FROM table_name
WHERE column_name operator value
PHP code Example:
$myquery= mysql_query("SELECT * FROM Persons
WHERE FirstName='John' ");
$result=mysql_query($myquery);
if(!$result)
{
$error = "Query fail!";
return($error);
}
Where Clause with variable
$myquery ="select * from userdb where user = '".$myuser."' and usepw= '".$mepw."' ";
this clause specific 2 variables those are:
$myuser => ' " .$myuser. " '
$mepw => ' " .$mepw. " '
Please Note: ' " .$myuser. " ' => must no space => should be '".$myuser."'
No comments:
Post a Comment