Jump to content

Arrays


Cod-nes

Recommended Posts

My array:

$aquamyarrays = array();$aquamyarrays['UserAgent'] = array('Googlebot','MSNBot','Yahoo','Alexa');$aquamyarrays['Visits'] = array();$aquamyarrays['Visits'][] = array('Googlebot','index.php','Dec 11'); //Bot, page, and time$aquamyarrays['Visits'][] = array('MSNBot','index.php','Dec 1');$aquamyarrays['Visits'][] = array('Googlebot','index.php','Dec 12');$aquamyarrays['Visits'][] = array('Googlebot','stats.php','Dec 11');And so on.
How can I can select only the googlebot visits from $aquamyarrays['Visits']? (In mysql it would be SELECT * FROM TABLE WHERE bot = 'Googlebot'))
Link to comment
Share on other sites

Databases are quite complex applications, they use special data sorting techniques when adding, retrieving or manipulating information.To do that in PHP, you will have to loop through the array elements and test each one.

foreach ($aquamyarrays['Visits'] as $item) {  if($item[0] == 'Googlebot') {	// Do something with $item  }}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...