terran11355@
06-24-2005, 12:17 PM
Hi guys,
i am currently write a few lines code to display all news from mysql by date.
db is abc, and there is table called news.
here is the code:
<?php
$username = "xxx";
$password = "xxx";
$hostname = "localhost";
$db = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("abc",$db)
or die("Could not select abc");
$result = mysql_query('SELECT * FROM news' . 'ORDER BY date DESC');
$news = array();
while ($result = $db->row_array()) {
$news[] = $result;
}
?>
but this code seems doesn't work at all.
i need help to show news on outside pages like anywhere in html or php pages.
Thanks guys!!!
sean
i am currently write a few lines code to display all news from mysql by date.
db is abc, and there is table called news.
here is the code:
<?php
$username = "xxx";
$password = "xxx";
$hostname = "localhost";
$db = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("abc",$db)
or die("Could not select abc");
$result = mysql_query('SELECT * FROM news' . 'ORDER BY date DESC');
$news = array();
while ($result = $db->row_array()) {
$news[] = $result;
}
?>
but this code seems doesn't work at all.
i need help to show news on outside pages like anywhere in html or php pages.
Thanks guys!!!
sean
