On 3/14/2009 5:13 PM, "Christian Wagner" <chris@xxxxxxxxxxxxx> wrote: > Hi, > I would select all items with a single select. >> SELECT name,model, condition (etc....) FROM inventory > > Then i'll iterate through the resultset and store them in an array like this > > $items = array(); > while($row = next()) > { > // Gives the total amount of Models > $items[$row['model']] = $counter++; > // Stores the condition of a single item of a model > // $items[$row['model']] makes sure, that the single item > // will be stored at the correct position > // > $items[$row['model']][$row['id']] = $row['condition']; > } Here's my query... (no group by - right?) mysql_select_db($database_test, $ test); $query_getall = "SELECT id, model,condition FROM inventory ORDER BY model ASC"; $getall = mysql_query($query_getall, $test) or die(mysql_error()); $row_getall = mysql_fetch_assoc($getall); $totalRows_getall = mysql_num_rows($getall); Thanks for your help Christian, I guess my 'newbie' is showing ... Because I'm having trouble getting this to work... 1 - on this line I get : Warning: Wrong parameter count for next() in /Libr... while($row = next()) - I tried this - with no errors while($row = mysql_fetch_assoc($getall)); // not sure if it's right? -------------- 2 - Then got error here: Warning: Cannot use a scalar value as an array in /Library/WebServer $items[$row['model']][$row['id']] = $row['condition']; Q: How can I fix this? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php