PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
include 'header.htm';
include 'config.php";
function index(){
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot connect to database");
$query = "SELECT title, text FROM blog ORDER BY id DESC LIMIT 10";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
$title=$r["title"];
$text=$r["text"];
echo "<td class='text1' height='75'><img src='images/bullet4.gif' width='16' height='15' align='center'><font color='#003366'><b>$title</b></font><br>$text</td></tr></tbody></table><br>";
}
mysql_close($db);
}
function news(){
echo "<td class='text1' height='75'><img src='images/bullet4.gif' width='16' height='15' align='middle'><b><font color='#003366'>News</font></b><br>";
echo "Blog still being worked on, hopefully up soon";
}
function submit(){
echo "<form name='post' action='post_news_process.php' method='post'>Title<input name='title' type='text' size='25'><br>Text<br><textarea name='text' cols='40' rows='6'></textarea><input type='submit' name='Submit' value='POST'></form>";
}
switch($_REQUEST['do']){;
default:
index();
break;
case "news":
news();
break;
case "submit":
submit();
break;
}
include 'footer.htm';
?>