Jump to content

Arrays


Cod-nes
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...