WordPress.org

Ready to get started?Download WordPress

Forums

Allow PHP in Posts and Pages
No HTML-Table possible for SQL-Query-Results (2 posts)

  1. MelHoch
    Member
    Posted 1 year ago #

    Hello all,

    I am trying to echo an HTML-table with SQL-results from a database query with AllowPHP.
    What happens is, the header of my table is correctly echoed as a table. The results of my query are echoed as well but not as a table.
    Can anybody help?

    Here is my code:

    [php]
    global $allow_php;
    $sql =
    "SELECT pic_and_link, DATE_FORMAT(valid_until, '%d.%m.%Y') as valid_until, value_of_this
    FROM wp_value";
    $result = mysql_query($sql);
    $allow_php->;_shared['my_query_results'] = $result;
    [/php]
    <table width="330">
    <tbody>
    <tr>
    <td width="110">Picture</td>
    <td width="110" style="text-align: right;">Value</td>
    <td width="110" style="text-align: right;">Valid</td>
    </tr>
    [php]
    global $allow_php;
    while ($my_row = mysql_fetch_array( $allow_php->;_shared['my_query_results']))
    {
    echo "<tr>";
    echo "<td width="110">", $my_row['pic_and_link'], "</td>";
    echo "<td width="110">", $my_row['value_of_this'], "</td>";
    echo "<td width="110">", $my_row['valid_until'], "</td>";
    echo "</tr>";
    }
    mysql_free_result( $allow_php->;_shared['my_query_results'] );
    [/php]
    </tbody>
    </table>

    Regards, Mel

    http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/

  2. Hit Reach
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mel,

    Is this using the advanced filter feature of the plugin? if not, you will need to write the table code being echoed in a bbcode format (square brackets!)

    Hope This Helps,
    Hit Reach

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic