$_SESSION['lines']
is populated from a textbox that a user pastes into. Before I do anything with the data, I want to run it through a filter to see if any of the values they've input are NOT in the database.
foreach ($_SESSION['lines'] as $q) {
$multiSupplierQuery = "SELECT distinct supplier from allparts where quotePartNumber = '$q'";
$multiSupplierResult = mysqli_query($con, $multiSupplierQuery);
while ($row = mysqli_fetch_array($multiSupplierResult)) {
$multiSupplier = $row['supplier'];
}
if (!multiSupplier) {
unset($_SESSION['lines'[]);
}
}
The crux of this revolves around this statement:
if (!multiSupplier) {
unset($_SESSION['lines'[]);
}
What I'm trying to say is: each time we cycle through this, if multiSupplier doesn't exist, remove this particular element from the array.
my unset
syntax is wrong though... how do I make it right?