get_results( “SELECT * FROM testdb”); // Query to fetch data from database table and storing in $results
if(!empty($results)) // Checking if $results have some values or not
{
echo “
“; // Adding and tag outside foreach loop so that it wont create again and again
echo ““;
foreach($results as $row){
$userip = $row->user_ip; //putting the user_ip field value in variable to use it later in update query
echo ““; // Adding rows of table inside foreach loop
echo “” . $row->col01 . “ | ” . “” . $row->col02 . “ | “;
}
echo “
“;
echo “
“;
}
?>