At the moment, I have created a code that retrieves data from the database and displays it. However, for some reason, I cannot see the files I want to retrieve on my page. My goal is that the data gets retrieved from the database, and is displayed on the webpage. I do not need to make a connection with the database since Wordpress does that automatically.
My code:
<?php
global $wpdb;
// this adds the prefix which is set by the user upon instillation of wordpress
$table_name = $wpdb->prefix . "wpex_programma";
// this will get the data from my table
$retrieve_data = $wpdb->get_results( "SELECT * FROM wpex_programma" );
?>
<!--This will display my files-->
<ul>
<?php foreach ($retrieve_data as $retrieved_data){ ?>
<li><?php echo $retrieved_data->column_name;?></li>
<li><?php echo $retrieved_data->another_column_name;?></li>
<li><?php echo $retrieved_data->as_many_columns_as_you_have;?></li>
<?php
}
?>
</ul>
My question: the data is not shown and I believe it is not retrieved. How can I fix that?
My database structure:
You can check the data from your database table. In PHP MySQL database. you can find the table name after the prefix of the table which you have decided while installing the WordPress. there should be your column name exact. with the table name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With