WPDB get_results, unable to get data formatted
-
Hi Guys,
I’m using a custom table in my wordpress database and am using wpdb to query the complete content of this table.
This is what i am using:
global $wpdb; $allposts= $wpdb->get_results("SELECT * FROM test", ARRAY_A); echo '<table>'; foreach ($allposts as $key => $value){ echo '<tr>'; echo '<th>' .$value["test"]. '</th>'; echo '<th>' .$value["test1"]. '</th>'; echo '<th>' .$value["test2"]. '</th>'; echo '<th>' .$value["test3"]. '</th>'; echo '<th>' .$value["test4"]. '</th>'; echo '</tr>'; } echo '</table>';
Unfortunately i can’t get this data in the correct format. All de information is displayed without enters and doesn’t seem to accept my table, th etc.
What am i doing wrong?
I’m using a plugin to be able to enter php code in my wordpress page.
Any help will be appriciated, Many thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WPDB get_results, unable to get data formatted’ is closed to new replies.