<?php
$data = $wpdb->get_results("SELECT * from .....);
if ( ! empty($data) )
{
foreach ( $data as $data )
{
$Ann = $Ann . "['','".$data->gAnn_text."',''],";
}
$Ann=substr($Ann,0,(strlen($Ann)-1));
?>
<!-- SOME CODES -->
<?php
}
else
{
?>
<!-- SOME CODES -->
<?php
}
?>
THE ABOVE CODE IS SOME PART OF A PLUGIN AT WORDPRESS BLOG.
Now pls forget wordpress, i have simple database with one table "news" and fields "id" and "texts". My "texts" field corresponds to field "gAnn_text" at above wordpress code. How can i manipulate my texts field so that it outputs just the above wp code.?
in other words how can i write the above codes without using wordpress.
what do i need to write instead of the following code
if ( ! empty($data) )
{
foreach ( $data as $data )
{
$Ann = $Ann . "['','".$data->gAnn_text."',''],";
}
$Ann=substr($Ann,0,(strlen($Ann)-1));
?>
thank you.