Pulling the next 10 upcoming appointments into a dashboard widget

Hey guys, hope all is well.

Currently working on a big muti-site project. I have installed and am planning to use the appointments+ plugin, all looks good so far.

One thing I have done to my users sites is add a number of custom dashboard widgets containing info. I would like to pull the next 10 (or however many) upcoming appointments into a dash widget.

I have already created the widget and have the table displaying correctly with all the correct bits of PHP in there to display the appointments.

I am looking for some help in getting the actual data into the table though. I am guessing a custom SQL command would work?

Here is what I have so far:

// Dashboard - Upcoming Appointments

function dashboard_widget_function_appointments() {

echo 'A summary of your upcoming appointments.';

echo '<table cellspacing="0" class="widefat"><thead><tr>';

echo '<th class="manage-column column-date app-column-" id="date" scope="col">Date/Time</th>';

echo '<th class="manage-column column-client app-column-" id="column" scope="col">Client</th>';

echo '<th class="manage-column column-service app-column-" id="service" scope="col">Service</th>';

echo '<th class="manage-column column-provider app-column-" id="provider" scope="col">Provider</th>';

echo '<th class="manage-column column-status app-column-" id="status" scope="col">Status</th>';

echo '</tr></thead><tfoot><tr><tbody>';

if($apps) {

foreach($apps as $key => $app) {

echo '<tr valign="middle" class="alternate app-tr">';

echo '<td class="column-date">';

echo mysql2date($this->datetime_format, $app->start);

echo '</td>

<td class="column-user">';

echo $this->get_client_name( $app->ID );

echo '<div class="row-actions">
<a href="javascript:void(0)" class="app-inline-edit">menu options here</a>
<img class="waiting" style="display:none;" src="light.gif" alt="light gif">

<td class="column-service">';

echo $this->get_service_name( $app->service );

echo '</td>
<td class="column-worker">';

echo $this->get_worker_name( $app->worker );

echo '</td>
<td class="column-status">';

if(!empty($app->status)) {
echo $app->status;

} else {

echo __('None yet.','appointments');


echo '</td>


else {

echo'<tr valign="middle" class="alternate" >

<td colspan="5" class="noappointments" scope="row">No appointments have been found - <a href="#">Add an appointment now</a></td>



echo '</tr>


If you could help me add the remaining code in order to get the correct data from the database that would be much appreciated. I am more of a front end developer so struggle a little with php/sql.

In another dash widget I have the following code, and I am guessing I need something similar for this also (if this is any help):

global $psts, $wpdb, $current_site, $blog_id, $current_user;
$levels = (array)get_site_option('psts_levels');
$current_level = $psts->get_level($blog_id);
$expire = $psts->get_expire($blog_id);
$result = $wpdb->get_row("SELECT * FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '$blog_id'");

All I actually need to display are the next 10 appointments based on date. it sounds pretty simple when I say it like that.

Thanks for any help! )