SQL query not functioning correctly, getting no output with a perfectly
fine query
code:
<?php
session_start();
if ( isset($_GET['user']) && isset($_GET['pass']) )
{
$sql = "SELECT * FROM `users` WHERE `name` = '" .
$_GET['user'] . "' AND `password` = '" . $_GET['pass'] . "';";
echo("query: $sql <br />");
$db = mysqli_connect("localhost", "root", "<password here>",
"1596");
if (mysqli_connect_errno($db)) { die("err"); }
$query = mysqli_query($db, $sql);
echo($query);
$row = mysqli_fetch_aray($db, $query);
echo($row);
if ($row['name'] == $_GET['user'])
{
$_SESSION['uid'] = $row['name'];
$_SESSION['level'] = $row['level'];
echo("logged in as " . $_SESSION['uid']);
}
}
else
{
die("Error, not enough parameters");
}
?>
If I run that query on server, it is fine.. there is no connect error, so
wondering where I went wrong
No comments:
Post a Comment