have this code so someone can check the authenticity of their product buy typing their serial number into a box and it will show if the product come from me and that works perfectly fine but my problem is that I'm trying to echo another Column in the same row that the serial number is in so it will also echo a description of the product once the correct serial number is entered, I've tried a few thing but I'm just going around in circles, any help would great, thanks in advance.
<?php
if(isset($_POST['pin']))
{
// include Database connection file
include("db_connection.php");
$pin = mysqli_real_escape_string($con, $_POST['pin']);
$query = "SELECT pin,product FROM auth WHERE pin = '$pin'";
if(!$result = mysqli_query($con, $query))
{
exit(mysqli_error($con));
}
if(mysqli_fetch_array($result) > 0)
{
// authentic code entered
echo '<div style="color: green;"> <b>'.$pin.'</b> This is a genuine product </div>';
}
else
{
// not valid code entered
echo '<div style="color: red;"> <b>'.$pin.'</b> Your product is not authentic! </div>';
}
}
?>