To put it simply, I'm trying to search an entire row for a 5 digit number that is parsed in via the URL.
This is the code I have so far:
$code = $_GET['code'];
$connect = mysqli_connect("localhost", "root", "", "test") or die("Could not connect to database!");
$query = mysqli_query($connect, "SELECT * FROM codes");
while($row = mysqli_fetch_array($query))
{
if($code == $row['code'])
{
echo "Code valid";
break;
}
else
{
echo "Invalid code";
break;
}
}
This code partly works, but only outputs "Code valid!" when the first value from the database (12345) is parsed in.
I've seen the mysql LIKE clause mentioned a few times here, but I haven't been able to get it to work so far. I'm still pretty amateur, so apologies if I'm completely missing something.