coolumanga
01-24-2012, 03:55 AM
here is my code
$connection = mysql_connect("localhost", "user", "xxxxx");
mysql_select_db("firefox");
$sql = "SELECT Internal FROM CusDec";
$result = mysql_query($sql);
$count = 0; // set a counter variable to zero
$employee_array = null; // this is our empty PHP array
while ($row = mysql_fetch_array($result)) // iterate through array
{
// store results from mysql in our own PHP array
$employee_array[$count] = $row['Internal'];
// increment counter
$count++;
}
mysql_close($connection);
// we can now iterate through our own array to retrieve the data
for ($i = 0; $i < count($employee_array); $i++)
//echo $employee_array[$i] . '<br />';
//$arr1 = $employee_array[$i];
//echo $arr1;
// construct a new array:1,2....max(given array).
$arr2=range(7,max($employee_array[$i]));
// use array_diff to get the missing elements
$missing = array_diff($arr2,$employee_array[$i]);
$connection = mysql_connect("localhost", "user", "xxxxx");
mysql_select_db("firefox");
$sql = "SELECT Internal FROM CusDec";
$result = mysql_query($sql);
$count = 0; // set a counter variable to zero
$employee_array = null; // this is our empty PHP array
while ($row = mysql_fetch_array($result)) // iterate through array
{
// store results from mysql in our own PHP array
$employee_array[$count] = $row['Internal'];
// increment counter
$count++;
}
mysql_close($connection);
// we can now iterate through our own array to retrieve the data
for ($i = 0; $i < count($employee_array); $i++)
//echo $employee_array[$i] . '<br />';
//$arr1 = $employee_array[$i];
//echo $arr1;
// construct a new array:1,2....max(given array).
$arr2=range(7,max($employee_array[$i]));
// use array_diff to get the missing elements
$missing = array_diff($arr2,$employee_array[$i]);