When I used the code below I get the correct result from my database.
$jobnumber= 'Agen912-493';
$sql =
"
SELECT *
FROM jobcards
WHERE jobnumber='$jobnumber'
";
$result = mysqli_query($conn, $sql);
However when I swap
$jobnumber= 'Agen912-493';
for
$jobnumber= $_GET["jobnumber"];
I get 'no results' from the database. However I know for certain that
$_GET["jobnumber"];
is returning the exact same Agen912-493
because I have echoed $jobnumber
after setting it equal to $_GET["jobnumber"];
and it returns Agen912-493
.
After two hours of head scratching I am at a complete loss to understand whats going wrong here. Simply all I want to do is use the result of a GET[]
call (that I have checked is returning the correct string) in the WHERE
condition.
Can anyone shed any light on what is going on here please?