I ran into a problem which is hard to explain, but I will try...
I've created a PHP script which lists all the PC components from MySQL table and sends complete list to subscribed customers.
This is the simplified version of the structure I use:
$components = array("Cases" => array('01','02','03'),
"Mainboards" => array('04','05','06','07'),
"Processors" => array('08','09'),
"Hard disks" => array('10'),
"Keyboards" => array('11','12','13'));
The double qouted values are PC groups, and inner arrays contain keys of the subgroups stored in MySQL table.
I loop through this array using double foreach() statement and create MySQL query.
foreach($components as $group => $subgroup)
{
$query = "select * from sroba, magzbir where sroba.GRUPASIFRA in (";
foreach($subgroup as $id)
{
if(next($subgroup)) $query = $query."'".$id."',";
else $query = $query."'".$id."'";
}
$query = $query.") AND sroba.ROBASIFRA = magzbir.ROBASIFRA order by sroba.ROBANAZIV asc";
$result = mysql_query($query);
}
The problem is that this approach behaves very strange. Sometimes it works ok, but very often query results are incomplete, e.g. it only lists processors or cases, like they have been ripped out of the array???
The server is under Linux...
Help!!!