Grupperet udtræk fra MySQL
HejJeg har disse data:
***
CREATE TABLE statisticsInfo (
id smallint(10) NOT NULL auto_increment,
dato datetime NOT NULL default '0000-00-00 00:00:00',
ip varchar(15) NOT NULL default '',
colorDepth varchar(50) NOT NULL default '',
resolution varchar(50) NOT NULL default '',
agent varchar(100) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=ISAM PACK_KEYS=1;
#
# Dumping data for table `statisticsInfo`
#
INSERT INTO statisticsInfo VALUES (1, '2002-09-25 11:39:29', '80.199.7.6', '32', '1280x1024', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)');
INSERT INTO statisticsInfo VALUES (2, '2002-09-25 11:40:50', '80.199.7.6', '32', '1280x1024', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)');
INSERT INTO statisticsInfo VALUES (3, '2002-09-25 11:43:08', '80.199.7.6', '32', '1280x1024', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)');
INSERT INTO statisticsInfo VALUES (4, '2002-09-25 12:04:42', '80.199.7.6', '32', '1280x1024', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)');
INSERT INTO statisticsInfo VALUES (5, '2002-09-25 12:04:45', '80.199.7.6', '32', '1280x1024', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)');
INSERT INTO statisticsInfo VALUES (6, '2002-09-25 19:31:32', '62.243.212.131', '32', '1024x768', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
INSERT INTO statisticsInfo VALUES (7, '2002-10-04 11:02:23', '193.163.255.36', '32', '1280x1024', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; Maersk Data AS)');
***
...Dem vil jeg gerne have trukket ud på følgende måde:
$records = totale antal poster
$numberOfDifferentColorDepths = antal forskellige input i 'colorDepth ' (i dette tilfælde er der kun '32', så antallet vil være 1).
$colorDepth1type = "32"
$colorDepth1number = 7
Så samme måde med resolution og agent.
Jeg håber at det giver mening og at nogen kan hjælpe...
Her er mit script so far:
***
CASE "getInfo":
$query = mysql_query("SELECT count(*) as number FROM $myInfoTabel") or die(handleError(mysql_error()));
$row = mysql_fetch_array($query);
echo "records=".$row["number"];
break;
***
VH
Anders Thingholm
