I am trying to print data from the database to WordPress. However, it is not working as expected. I also tried to print a simple variable.
$host="localhost"; // Host name
$username="root"; // username
$password=""; // password
$db_name="bk"; // Database name
// Replace database connect functions depending on database you are using.
mysql_connect("$host", "$username", "$password");
mysql_select_db($db_name);
$tbl_nm="rg";
global $wpdb;
$a=6;
$B=9;
$result = $wpdb->get_results ( "SELECT nm FROM rg" );
foreach ( $result as $print ) {
?><tr><td><?php
echo $print->nm;
print $a+$B;
?></td>
</tr>
<?php }
1 comment
Comments are closed.