i have the following php code:
$range=range(1,$count);
$value=implode(",",$range);
$query1="SELECT DISTINCT numar_factura FROM creeazafactura WHERE numar_factura IN ($value)";
$result1=mysql_query($query1);
while ($rowx = mysql_fetch_assoc($result1)) {
$getvalue[]=$rowx['numar_factura'];
}
$missingvalue = array_diff($range,$getvalue);
print_r($range);
print_r($getvalue);
print_r($missingvalue);
with the output:
Array
(
[0] => 1
[1] => 2
[2] => 3
)
Array
(
[0] => 1
[1] => 2
)
Array
(
[2] => 3
)
what i'm trying to figure out is, how to do so that the following line
printf("WARNING: The invoice $missing[2] is missing.");
will work always. Why i'm telling always? Because now id deleted the 3rd invoice, but if i delete the second invoice i will have array[1] to output in $missing
The answer is to make a loop so that i will have in the printf the $missing[$loop],
where the loop is searching for one or two invoices deleted.. and output 1 or two lines.
Easy to say, hard to do, when you are a beginner and you want to do an easy invoice system for a friend who uses excel :)
If you could provide some examples, or some links to some documentation, you could do me a great favor. Thank you