[PHP] news display

2001-09-12 Thread nate

Hey all!

I have a slight problem I was hoping you could help me with. I'm writing a little news 
script for my site, and well here is the scenario:

I have 2 tables in a mysql database, one holds author information (name, email, 
password, etc.)
The other table holds the news that they submit (news, date, time, headline, etc.)

Now I am trying to display the news on a page, ordered of course by date (or id in 
this case) and well i'm using the code below.

?php

$db = mysql_pconnect(localhost);
mysql_select_db(news,$db);

$result1 = mysql_query(SELECT * FROM news,authors ORDER BY `id` DESC,$db); 

while($myrow=mysql_fetch_array($result1))
{
echo table cellpadding=0 cellspacing=0trtdimg src=images/r13.gif/tdtd 
background=images/r14.gif 

width=100%pfont size=2 face=verdana color=whitestrong . $myrow[headline] . 
/strong/FONT
font size=1 face=verdana color=whitebrPosted by A HREF=mailto:; . $myrow[email] 
.  . 

$myrow[author] . /A at  . $myrow[time] . $myrow[$tod] . 
/FONT/tdtdimg 

src=images/r15.gif/td/tr/tablebrFONT COLOR=white SIZE=2 FACE=verdana . 
$myrow[news] . 

brbr;
}
?

So the results would look something like:

$Headline
Posted by $author at $time

$news

and it would of course just repeat, for however many entries there is.

Now the problem:
If I enter 4 news posts a day, I want to show 1 date above all the news posts. 
(Instead of 1 date next to each news post) Any idea how I can do this (In easy to 
understand lingo/code please)?


Thanks!

Nate



Re: [PHP] news display

2001-09-12 Thread nayco

-
$result1 = mysql_query(SELECT * FROM news,authors ORDER BY `id` DESC,$db);

I think something like WHERE news.id=author.id is missing .
And I made a few scripts like this one, and i think you should ORDER BY
date .



(°-Nayco,
//\[EMAIL PROTECTED]
v_/_ http://nayco.free.fr


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 12, 2001 12:04 PM
Subject: [PHP] news display


Hey all!

I have a slight problem I was hoping you could help me with. I'm writing a
little news script for my site, and well here is the scenario:

I have 2 tables in a mysql database, one holds author information (name,
email, password, etc.)
The other table holds the news that they submit (news, date, time, headline,
etc.)

Now I am trying to display the news on a page, ordered of course by date (or
id in this case) and well i'm using the code below.

?php

$db = mysql_pconnect(localhost);
mysql_select_db(news,$db);

$result1 = mysql_query(SELECT * FROM news,authors ORDER BY `id` DESC,$db);

while($myrow=mysql_fetch_array($result1))
{
echo table cellpadding=0 cellspacing=0trtdimg
src=images/r13.gif/tdtd background=images/r14.gif

width=100%pfont size=2 face=verdana color=whitestrong .
$myrow[headline] . /strong/FONT
font size=1 face=verdana color=whitebrPosted by A HREF=mailto:; .
$myrow[email] .  .

$myrow[author] . /A at  . $myrow[time] . $myrow[$tod] .
/FONT/tdtdimg

src=images/r15.gif/td/tr/tablebrFONT COLOR=white SIZE=2
FACE=verdana . $myrow[news] .

brbr;
}
?

So the results would look something like:

$Headline
Posted by $author at $time

$news

and it would of course just repeat, for however many entries there is.

Now the problem:
If I enter 4 news posts a day, I want to show 1 date above all the news
posts. (Instead of 1 date next to each news post) Any idea how I can do this
(In easy to understand lingo/code please)?


Thanks!

Nate



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]