Displaying file from database [duplicate]


I have made the following code:


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 your table
$retrieve_data = $wpdb->get_results( "SELECT * FROM wpex_programma; " );
<?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>

The code makes sure the files get retrieved from the database. The file is saved by the path. I know that the file gets retrieved, because when I use print_r($retrieve_data) the id and name get shown.

However, the file is not displayed (it should display the file name, and not the path). How do I accomplish this?

What I see now is:

Array ( [0] => stdClass Object ( [id] => 35 [naam] => /public_html/wp/wp-content/plugins/AbonneerProgrammas/FilesUpload/Country Kickin 1.mp3 ) )

While it should just be “Country Kicking 1.mp3”.

Question: How can I make sure that my filenames are displayed?

For more info, see my other question: Retrieving and displaying data from a WordPress database

My query log:

enter image description here



, Parsa_237 10 months 0 Answers 101 views 0

Leave an answer