Created
December 21, 2011 16:23
-
-
Save scottcorgan/1506630 to your computer and use it in GitHub Desktop.
Dynamic Causes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$campaigns = array(); | |
$sql = "SELECT * FROM svn_posts WHERE post_type = 'shirts' AND post_date < now() ORDER BY ID DESC LIMIT 10"; | |
$query = $this->db->query($sql); | |
// create organized arrays of campaign data | |
foreach($query->result() as $campaign){ | |
$sql = 'SELECT * FROM svn_postmeta WHERE post_id = ' . $campaign->ID; | |
$results = $this->db->query($sql)->result(); | |
$meta = array(); | |
// loop through meta results and organize them | |
foreach($results as $result){ | |
$meta[$result->meta_key] = $result->meta_value; | |
} | |
// this array holds all the campaign info | |
$campaigns[$campaign->ID] = array( | |
'campaign' => $campaign, | |
'meta' => $meta | |
); | |
} | |
// this array doesn't work. | |
// need to work on the organization of the meta data | |
return $campaigns; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment