Home / Disable / Mytestsnippet
Duplicate Snippet

Embed Snippet on Your Site

Mytestsnippet

Testing

Edwin van Zyl
<10
Code Preview
php
<?php
global $wpdb;
$table_name = $wpdb->prefix . 'myfirst'; // Use prefix for security
$results = $wpdb->get_results("SELECT * FROM $table_name");
if ( ! empty( $results ) ) {
    echo '<table>';
    foreach ( $results as $row ) {
        echo '<tr>';
        echo '<td>' . esc_html( $row->id ) . '</td>';
        echo '<td>' . esc_html( $row->description ) . '</td>';
        echo '</tr>';
    }
    echo '</table>';
} else {
    echo 'No data found.';
}

Comments

Add a Comment