Code: Select all
<?PHP
//connecting to the database with host, user and pwd
$Connect=mysql_connect(localhost,***,***) or die("Sorry, unable to connect to DataBase(1)");
//selecting DB to get info from
$DB=mysql_select_db(***,$connect);
$query="select * FROM news";
// executing the query
$result=mysql_query($query) or die ("sorry unable to connect to DB(2)".mysql_error());
//putting results into a array then looping thru and echoing the array
$returned=mysql_num_rows($result);
if($returned>1)
{
while($row=mysql_fetch_array($result));
{
echo("&");
echo("<table border=\"0\" celpadding=\"1\" cellspacing=\"1\">");
echo("<tr>");
echo("<td><P>------------------------------------------------------------------------------------------------</P>");
echo("".$row["Date"]);
echo("</td>");
echo("</tr");
echo("<tr>");
echo("<td>");
echo($row['News']);
echo("</td>");
echo("<P>------------------------------------------------------------------------------------------------</P>");
echo("</tr>");
echo("</table>");
}
}else if($returned<1)
{
echo("Sorry No News Posted");
}
?>
rite this is for a news area that i am going to be able to update via a from, it is eventually going to be a news board weer users can post!! could n e 1 help with this!?