My php code can't be display on browser.
Posted: Tue Sep 01, 2009 3:04 pm
My php code can't be display on browser. I get problem loading page. I don't know what I'm doing wrong? Please help. I was thinking to trying my code on a non 64bit os. That is probably causing my problem. I posted in two other forums but no reply, and no answer. Thank you in advance.
The problem starts in the while loop. Just note that I created my database table on the Mysql console.
The problem starts in the while loop. Just note that I created my database table on the Mysql console.
Code: Select all
<?php
//sql connecting
$iscon = mysqli_connect('localhost','root','password');
if(!$iscon)
{
die('Could not connect to mySQL: ' . mysqli_connect_errno($iscon) . '<br/>' . mysqli_connect_error($iscon) . '<br/>');
}
?>
<?php
if ( !mysqli_select_db($iscon,'juniblog') )
{
echo 'Database doesn\'t excist: ' . mysqli_error($iscon) . '<br/>';
echo "Creating new database....<br/>";
if( mysqli_query($iscon, 'CREATE DATABASE juniblog') )
echo 'Database has been created successfully..';
else
echo die('An error has occured creating database: ' . mysqli_error($iscon));
}
else
echo "Database excist and is selected.";
?>
<?php
$junitable = mysqli_query($iscon, "select * from messageblog");
echo "Hello Milena!<br/>";
while($row = mysqli_fetch_array($junitable))
{
echo "<div style=\"border:thin black solid\">";
echo '<p>' . 'Titlte:' . $row['title'] . '</p>';
echo '<p>' . 'Message:' . $row['postmessage'] . '</p>';
echo '<p>' . 'Author:' . $row['author'] . '</p>';
echo '<p>' . 'Date:' . $row['date'] . '</p>';
echo "</div>";
}
?>
<?php mysqli_close($iscon); ?>