display results in a table from the database
-
Hi,
I want to display some data “in a table already created in my website” from my database.
I have already created a part of code to filled my table with the data already stored in my database as follows:
// creation of my table <div class="my_box3"> <div class="box_title"><?php echo __("Title"); ?></div> <div class="box_content"> <table border="1"> <tr><th>A1</th><th>City</th><th>A2</th><th>A3</th><th>A4</th></tr> <?php // fill my table with recovered data $ci=array_filter(get_post_meta(get_the_ID(),'CITY')[0]); $ci=array_values($ci); for($i=0;$i<count($ci);$i++) {?> <tr><td><?php echo load_by_id($co[$i],"table","ID",$wpdb)->NAME;?> <?php }?> </table> </div> </div>
It’s running locally on my PC but when I put In in my cPanel I get this error message:
Parse error: syntax error, unexpected ‘[‘ in /home/MyFolder
in this line:
$ci=array_filter(get_post_meta(get_the_ID(),’CITY’)[0]);I already delete the ‘[‘ but it still doesn’t work, all I get is a table with array()!!
is there another command to replace this!!
Any help will be appreciated and Thanks in advance
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘display results in a table from the database’ is closed to new replies.