I'm learning how to write a shortcode. I'm getting this error: Parse error: syntax error, unexpected T_FOREACH . I'm having problems with concatenating it properly.
<?php
/*
Plugin Name: My Plugin
Plugin URI: http://mysite.com
Description: This does blah
Version: 1.0
Author URI: http://www.mysite.com
*/
function csf_cap_databaseinfo() {
global $wpdb;
$greeting = $wpdb->get_results($wpdb->prepare("SELECT * FROM wp_test;"));
$out = '<table>
<tr>
<th>ID</th>
<th>Greeting</th>
</tr>';
$out .= foreach ($greeting as $greet){ .'<tr><td>' . echo $greet->id . '</td></tr>' . } .'</table>';
return $out;
}
add_shortcode('db-info', 'csf_cap_databaseinfo');
?>
Any suggestion on how to fix this error? Thank you.
-Laxmidi