43 reputation
4
bio website miedema.co.za
location Cape Town, South Africa
age 31
visits member for 2 years, 4 months
seen Oct 11 '12 at 11:35

Oct
4
comment Display data from a non wordpress database on a page template
I also meant to say, I am copy pasting the DB details straight out of my hosting control panel in the order specified by wpdb and what you guys wrote above so Im almost certain its the right db.
Oct
4
comment Display data from a non wordpress database on a page template
If I try the following it just returns blank 'nothing to see here' $query = "SELECT TrainerName FROM trainers"; $races= $newdb->get_results($query); if (empty($races)) { ?> <p>Nothing to see here.</p> <?php } else { ?> <table id="rr"> <tr><th>Trainer</th></tr> <?php foreach($races as $race): ?> <tr> <td><?php echo $race->TrainerName; ?></td> </tr> <?php endforeach; ?> </table>
Oct
2
answered Open attachments in new tab/window
Oct
2
comment Display data from a non wordpress database on a page template
I tested the actual sql query in phpmyadmin to see if it works and it did. Is that what you mean when you say "You should also test that the query actually returned something before using the result in a foreach loop"
Oct
2
comment Display data from a non wordpress database on a page template
I forgot to mention I have included the database login details I just omitted them above so it wasn't shown to the whole world. ('user', 'password', 'database', 'hostname')
Oct
1
asked Display data from a non wordpress database on a page template
Aug
30
awarded  Tumbleweed
Aug
1
awarded  Supporter
Jul
5
awarded  Scholar
Jul
5
accepted Filter post listing by meta value which is a date
Jul
5
comment Filter post listing by meta value which is a date
Ah of course, it was indeed the dashes that solved it, thx bro you rock!
Jul
5
comment Filter post listing by meta value which is a date
I presume Im being silly. I changed meta_key to the one Im using ie 'historic-date'. I cant make sense of the debugging results link Not sure why wpse57351_pre_get_posts is not doing it job as there are no errors.
Jul
4
comment Filter post listing by meta value which is a date
Thanks Stephen, its almost working now except when I filter by the custom date non of the posts appear for that month. It is recognising the custom field though, as it appears with the correct years and months in the drop down box for custom date.
Jul
4
suggested suggested edit on Filter post listing by meta value which is a date
Jul
3
awarded  Student
Jul
3
comment Filter post listing by meta value which is a date
It is being stored as YYYY-mm-dd.
Jul
3
asked Filter post listing by meta value which is a date