So i have this index.php code:
<form method="get" action="search.php">
<label>Search For: </label><input type="text" name="$res" />
<input type="submit" name="submit" value="Start Search" />
<input type="reset" value="Reset"
</form>
And this code in search.php
<?php
$con = mysqli_connect('localhost','user', 'pass') or die(mysqli_error($con));
mysqli_select_db($con, 'piese') or die(mysqli_error($con));
#query database
$query = mysqli_query($con, "SELECT `id`,`price` FROM `edit` ORDER BY `id`");
#check for a result set
if($query && mysqli_num_rows($query) > 0)
{
while($res = mysqli_fetch_assoc($query))
{
echo "{$res['id']}:The price is {$res['price']},<br />";
}
}
else #if no result set, then output a message
{
echo 'No results.';
}
?>
I search for an ID ( that have a value on database ) ex: 2345 and this show me all the rows i've in database .. Where i'm wrong?