blacknight Posted September 7, 2006 Share Posted September 7, 2006 we have a database where we store computer parts and we use these parts to build systems this is what i need to know say i have somthen like thisvideo card x 10mobo x 5Ram x 7Hdd x 9no by looking at this i can see that i can make 5 systems but i was a php script that compares up to 10 compoments and tells me how many i can make can some one help me with this? Link to comment https://forums.phpfreaks.com/topic/20038-products-avaluable/ Share on other sites More sharing options...
Barand Posted September 7, 2006 Share Posted September 7, 2006 Assuming 1 of each per system[code]<?php$parts = array( 'video card' => 10, 'mobo' => 5, 'Ram' => 7, 'Hdd' => 9 );echo min($parts); // --> 5?>[/code]Or, direct from DB,[code]<?php$sql = "SELECT MIN(qty) FROM parts";$res = mysql_query($sql);echo mysql_result ($res, 0, 0);?>[/code] Link to comment https://forums.phpfreaks.com/topic/20038-products-avaluable/#findComment-87932 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.