I have a SQL database I’m trying to query with PHP. It’s for user accounts and I need to test if a certain username and password combination exist in the database.
Currently, I can check if just a username exists by using:
<?php
session_start();
include "config.php";
if($_POST['nameQuery']) {
$query = "SELECT * FROM ichatlogin WHERE name = '" .$_POST['nameQuery']. "'";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0) {
//User exists
echo '1';
} else {
mysql_query($query);
//User does not exist
echo '0';
}
}
?>
Thanks!
You can make as many logical comparisons as you need. Combine them with AND or OR as appropriate.