I have the following:
$verf = "SELECT nro_transf FROM pedidos WHERE nro_transf = '$nro_transf'";
$result = mysqli_query($db, $verf);
$rows = mysqli_num_rows($result);
$verf2 = "SELECT nro_transf FROM pagos WHERE nro_transf = '$nro_transf'";
$result2 = mysqli_query($db, $verf2);
$rows2 = mysqli_num_rows($result2);
$sumarows = $rows + $rows2;
Practically what I occupy is that if the data provided by the user in my payment declaration form already exists in my database then I do not accept the declaration (These are already declared and functional) as I have it it works if and only if the number that you try to use is exactly the same as the number that exists in my database, but I have found that there are users that if there is already a statement:
nro_transf = 123456
They try to cheat by placing a similar number example:
nro_transf = 1123456
nro_transf = 00123456
nro_transf = 01123456
My question would be:
What instruction can I give to my 2 queries so that apart from looking for the number as it was entered it will also do it if the last 6 digits are similar ..!
I know that with the instruction:
WHERE (nro_transf LIKE '%$nro_transf%')
I can do the filter but it turns out that there are transfers that almost 100% of them start with the same example digits:
0051411234
0051413456
0051416789
Where all are valid transfers but they start with the same number and the ideal is to filter by their last 4 or 6 digits that are different.