PDA

View Full Version : News Problem :(



мϊкэ
03-08-2005, 07:43 PM
Right on my news system i want to show the news titles and who the article is by in the the updates box, this strangely only works if your on the news page :s when i want it to work on all pages, anybody know whats wrong ! :s the page to show all of the news this is the source

the only page it works on is
www.xenigma.co.uk/index.php?page=news/viewnews


<?
include("dbconnect.php");//include the file to connect to the database
$getnews = mysql_query("SELECT 10 FROM mynews ORDER BY id DESC");//query the database for all of the news

while($r=mysql_fetch_array($getnews)){//while there are rows in the table
extract($r);//remove the $r so its just $variable

echo("MY NEWS LAYOUT!!!");

}

?>

the variables are

$title - the news' title
$user - who added the news
$date - Month/Day/Year
$message - news itself

and the page to show the updates is:


<?
include("news/dbconnect.php");//include the file to connect to the database
$getnews = mysql_query("SELECT 5 FROM mynews ORDER BY id DESC");//query the database for all of the news

while($r=mysql_fetch_array($getnews)){//while there are rows in the table
extract($r);//remove the $r so its just $variable

echo("$title by $user<br>");

}

?>

anybody know whats up :O this is probably one of my nooby mistakes which ill either realise at the last moment or somebody points it out to me and laughs at me like a noob :O

Please Help :'(
xEnigmA <3

мϊкэ
04-08-2005, 10:29 AM
:O Ignored Bump ^^

Edit by Urges - Please do not double post, Simply edit your last one. Thanks

Rix
04-08-2005, 10:32 AM
can u show me in better detail and i'll have a look

мϊкэ
04-08-2005, 11:04 AM
can i show you what in better detail? im giving you the source of whats on the news page and whats on the page were the updates are

what more can i give!

мϊкэ
04-08-2005, 12:38 PM
:O no help ^^ bump

[Edited By Partie2] (Forum Moderator) please dont bump your posts it just wastes forum space!

Mentor
04-08-2005, 12:54 PM
You mysql is wrong
$getnews = mysql_query("SELECT 5 FROM mynews ORDER BY id DESC");

its only selecting a row called 5 wich there probly isnt, what i think u want is

$getnews = mysql_query("SELECT * FROM mynews ORDER BY id DESC LIMIT 5");

мϊкэ
04-08-2005, 01:07 PM
thanks again mentor!

Want to hide these adverts? Register an account for free!