Title: PHP Not showing
Last modified: August 31, 2016

---

# PHP Not showing

 *  Resolved [ruaduck](https://wordpress.org/support/users/ruaduck/)
 * (@ruaduck)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-not-showing/)
 * For some reason the following code is not showing on my page at all:
 *     ```
       $db = new wpdb($username, $password, $dbname, $servername); 
   
       $row = $db->get_results("SELECT * FROM Event_Feeder ORDER BY id DESC LIMIT 25");
       $db->show_errors();
       echo "<table width=100%><font color=white size=4><tr><th width=33%>Date</th><th width=66%>Status</th></tr></font>";
       for ($i = 0; $i <= 25 ; ++$i)
       {
       	$date = $row->date;
       	$text = $row->text;
       	$color = $row->color;
       	if (!$query[$i]) {}
       else
       	{
       	echo " <font color=$color size=4><tr><td>$date</td> <td>$text</td></tr></font>";
       	}
       }
       echo "</table>";
       ```
   
 * I am not sure why. All the DB info is correct.
 * [https://wordpress.org/plugins/php-code-for-posts/](https://wordpress.org/plugins/php-code-for-posts/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [ruaduck](https://wordpress.org/support/users/ruaduck/)
 * (@ruaduck)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-not-showing/#post-7187487)
 * I have also tried:
 *     ```
       <?php
       $servername = "localhost";
       $username = "*****";
       $password = "*****";
       $dbname = "******"
       $db = new wpdb($username, $password, $dbname, $servername); 
   
       $row = $db->get_results("SELECT * FROM Event_Feeder ORDER BY id DESC LIMIT 25");
       $db->show_errors();
       echo "<table width=100%><font color=white size=4><tr><th width=33%>Date</th><th width=66%>Status</th></tr></font>";
       foreach ($rows as $row)
       {
       	echo " <font color=".$row->color" size=4><tr><td>".$row->date."</td> <td>".$row->text."</td></tr></font>";
       }
       echo "</table>";
       ?>
       ```
   
 *  Plugin Author [Jamie Fraser](https://wordpress.org/support/users/thejfraser/)
 * (@thejfraser)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-not-showing/#post-7187656)
 * There could be a multitude of reasons as to why its not outputting results
 * I would swap out your new instance of wpdb to global $wpdb;, assuming that the
   custom tables are in the same database
 * I would then var_dump $row just to make sure it has details in it
 * I would also not use font tags (they were deprecated in html4!)
 * Also have you tried the code else where? perhaps put it in your functions file
   as a test and see if it gets results there?
 * Cheers

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Not showing’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/php-code-for-posts_0d1022.svg)
 * [PHP Code for posts](https://wordpress.org/plugins/php-code-for-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-for-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-for-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-for-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-for-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-for-posts/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jamie Fraser](https://wordpress.org/support/users/thejfraser/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/php-not-showing/#post-7187656)
 * Status: resolved