Maria,
Maria Garcia Suarez sagte:
> Hi there!
>
> I'm currently developing a web where we let users
> create their own forums. All the messages (wherever
> they are posted) are stored in the same mysql table.
>
> When users read a certain message I would like to
> display the previous and next mes
Having developed such an app myself (albeit in Oracle where the wonder of 'connect by'
exists which according to 'to-do' lists is coming for MySQL yippie!), this is what
I recommend...
1- if your forum is 'threaded', i.e. a message is in response to another, you can use
that linking to get
Hi there!
--- Christopher Knight <[EMAIL PROTECTED]> wrote:
> next:
> select cols from table where id > YOUROLDID and
> forums = CURRENT_FORUM order by id limit 1
> previous:
> select cols from table where id < YOUROLDID and
> forums = CURRENT_FORUM order by id desc limit 1
Thanks for your answer
next:
select cols from table where id > YOUROLDID and forums = CURRENT_FORUM order by id
limit 1
previous:
select cols from table where id < YOUROLDID and forums = CURRENT_FORUM order by id
desc limit 1
however, this may not be as fast or efficient enough
ou might want to create another id field
esday, September 09, 2003 12:35
To: Mark Richards; [EMAIL PROTECTED]
Subject: RE: How to get previous and next result
Hi there!
--- Mark Richards <[EMAIL PROTECTED]> wrote:
> If you simply have a table with an id field that has
> the auto-increment
> attribute (field is int(10))
Hi there!
--- Mark Richards <[EMAIL PROTECTED]> wrote:
> If you simply have a table with an id field that has
> the auto-increment
> attribute (field is int(10)) then you can get the
> current id and go from
> there. To get the current ID of a record you just
> created, you can use the
> mysql_in
Maria,
If you simply have a table with an id field that has the auto-increment
attribute (field is int(10)) then you can get the current id and go from
there. To get the current ID of a record you just created, you can use the
mysql_insert_id($link) function in PHP, or the MySQL equivalent. Reme