C
Chris
Guest
what im trying to do is keep a count of each result. i am getting the syntax wrong for inserting the values into the arrays.
$all = array($id,$name,$extension,$price,"0");
// search $results to see if this result has been inserted
$addone =0;
$resultscount=count($results);
for ($q=0;$q<$resultcount;$q++)
{
//if the result is found
if($all[$q] == $id)
{
$addone=1; //
$slot=$q; // remember what slot this entry is in
}
}
//if the result was not found
if($addone <1)
{
//insert new entry
$results[$resultcount+1]=$all,[0]="1";
}else
{
//add one to the record that already exists.
$oldval = $results[$q][0];
$newval = $oldval+1;
$results([$q]=$all,[0]=$$newval;
}
$items++;
Any help is greatly appreciated.
Thanks!
$all = array($id,$name,$extension,$price,"0");
// search $results to see if this result has been inserted
$addone =0;
$resultscount=count($results);
for ($q=0;$q<$resultcount;$q++)
{
//if the result is found
if($all[$q] == $id)
{
$addone=1; //
$slot=$q; // remember what slot this entry is in
}
}
//if the result was not found
if($addone <1)
{
//insert new entry
$results[$resultcount+1]=$all,[0]="1";
}else
{
//add one to the record that already exists.
$oldval = $results[$q][0];
$newval = $oldval+1;
$results([$q]=$all,[0]=$$newval;
}
$items++;
Any help is greatly appreciated.
Thanks!