Hello,
If anyone could help me or something it would be greatly appreciated. I\'ve been getting help from the penguin (ner0) and we\'ve come up with this code and it\'s not working the way I want it and at the moment I can\'t get ahold of paul. So here goes the explaination of what it should be doing.
This code *should* display 3 of the latest entries from the database inside of a table. This will work for every category I have submitted into the database (The category is submitted inside the table the news is inserted into). I hope this all makes sense. Here is the code.
Okay update... I fixed it so here is the new code. It just isn\'t doing what I want now..... aka display the category in a cell and a list of the three latest news entries under it... :\
<?
$sql_host = "*";
$sql_user = "**";
$sql_pass = "";
$sql_db = "news";
//assuming your table is called news also...
$q = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 0 , 3");
/*The line selects all fields from news and then orders them by ID. Basically, if you have an auto-numerical
system for your IDs, then the highest ID is going to be the first post shown. Lets say you have a news post
titled "post one" with the ID of 84 and another with the ID of 83 titled "post two". Post one will be shown
before post two*/
while ($a = mysql_fetch_array($q)) {
echo "insert table or whatever here";
//variables are $a[fieldname]
}
?>
[color=\"green\"]edit the vercz way: fixed tags[/color]
Last edited by radar on Tue Sep 20, 2005 12:36 pm, edited 1 time in total.
Yes it\'s a news script, but you also have to grab the category which is with the news... So I have to grab the category and make sure the news is sorted into the right category... And it\'s not doing that now. It used to, but it doesn\'t now.
[align=center]
“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
I\'m a bit confused as what your trying to get the code to do. Can you paste an example of the table your querying? Particularly confused about the use of ID. Is it different for every entry, or different for every category? Can a category have more than one news report in it?