PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if (isset($_POST['v_number_1'])){
($voucher_1 = $_POST['v_number_1']);
mysql_select_db($database_, $);
$query_GetVouchers1 = "SELECT * FROM vouchers WHERE v_number = '$voucher_1'";
$GetVouchers1 = mysql_query($query_GetVouchers1, $) or die(mysql_error());
$row_GetVouchers1 = mysql_fetch_assoc($GetVouchers1);
$totalRows_GetVouchers1 = mysql_num_rows($GetVouchers1);
}
This returns an not valid message if the number is not in the database and valid if it exists however 0 lets it pass and I guess this is something to do with a true and false value but I’m not really sure.
if (isset($_POST['v_number_1']) && ($_POST['v_number_1'])=== $row_GetVouchers1['v_number']) {
// if it does exist then point that out
echo 'is valid ';
}else
{
echo 'not valid' ;
}
}
You've already checked for the v_number in the database, the second check should simply be of the number of rows returned by the statement. Replace this line: