Loading a recordset at the last record?

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Loading a recordset at the last record?

    How can I do that? I have a table with record that are updated periodically
    through the day. I want a page that only loads the last record. How?

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================


    Murray *TMM* Guest

  2. Similar Questions and Discussions

    1. recordset query to display record title hyperlinked
      Hi all, If anybody could please help me i would be most greatful! I have started builiding a front end website connected to a mysql database...
    2. JavaScript error while loading Recordset.htm
      After setting up my testing server (which uses PHP) I tried to create a recordset but get this error... Javascript error while loading...
    3. Showing a specific record from a recordset
      Hi, I am trying to find a way of displaying a specific record (the latest one entered by a user) from a recordset as opposed all of the records or...
    4. RecordSet.Move or RecordSet.AbsolutePosition??
      Hi, I'm trying to use either one of these methods to position the cursor in a specific position inside a recordset, but neither one seems to...
    5. Stop adding record in subform after record count = 1
      Can someone help in in what to put after the THEN statment to allow one entry if the Record count is =>1 in the Before insert or should I set the...
  3. #2

    Default Re: Loading a recordset at the last record?

    Murray *TMM* wrote:
    > How can I do that? I have a table with record that are updated periodically
    > through the day. I want a page that only loads the last record. How?
    SELECT * FROM mytable
    ORDER BY primary_key DESC
    LIMIT 1

    That's the MySQL way, the LIMIT clause may be different on other flavours.

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]
    David Powers Guest

  4. #3

    Default Re: Loading a recordset at the last record?

    Hmm - I don't see that in SQL, David. I'm using an Access database....

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "David Powers" <dp@example.com> wrote in message
    news:d5l4ln$4kc$1@forums.macromedia.com...
    > Murray *TMM* wrote:
    >> How can I do that? I have a table with record that are updated
    >> periodically through the day. I want a page that only loads the last
    >> record. How?
    >
    > SELECT * FROM mytable
    > ORDER BY primary_key DESC
    > LIMIT 1
    >
    > That's the MySQL way, the LIMIT clause may be different on other flavours.
    >
    > --
    > David Powers
    > Author, "Foundation PHP 5 for Flash" (friends of ED)
    > Co-author "PHP Web Development with DW MX 2004" (Apress)
    > [url]http://computerbookshelf.com[/url]

    Murray *TMM* Guest

  5. #4

    Default Re: Loading a recordset at the last record?

    Something like

    select * from t order by id desc

    --
    Jules
    [url]http://www.charon.co.uk/charoncart[/url]
    Charon Cart 3
    Shopping Cart Extension for Dreamweaver MX/MX 2004




    Julian Roberts Guest

  6. #5

    Default Re: Loading a recordset at the last record?

    Murray *TMM* wrote:
    > Hmm - I don't see that in SQL, David. I'm using an Access database....
    How strange that it doesn't have a way to limit the number of records
    retrieved. Just leave off the limit clause, and select the first record.
    Because they're presented in descending order, the first will be the
    last, if you see what I mean.

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]
    David Powers Guest

  7. #6

    Default Re: Loading a recordset at the last record?

    Ahh - that makes sense. That's basically what Jules suggested, too.

    Thanks!

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "David Powers" <dp@example.com> wrote in message
    news:d5lihs$ke4$1@forums.macromedia.com...
    > Murray *TMM* wrote:
    >> Hmm - I don't see that in SQL, David. I'm using an Access database....
    >
    > How strange that it doesn't have a way to limit the number of records
    > retrieved. Just leave off the limit clause, and select the first record.
    > Because they're presented in descending order, the first will be the last,
    > if you see what I mean.
    >
    > --
    > David Powers
    > Author, "Foundation PHP 5 for Flash" (friends of ED)
    > Co-author "PHP Web Development with DW MX 2004" (Apress)
    > [url]http://computerbookshelf.com[/url]

    Murray *TMM* Guest

  8. #7

    Default Re: Loading a recordset at the last record?

    Yep - makes sense indeed. Thanks, Jules.

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "Julian Roberts" <newsg@charon.co.uk> wrote in message
    news:d5lh1r$ioq$1@forums.macromedia.com...
    > Something like
    >
    > select * from t order by id desc
    >
    > --
    > Jules
    > [url]http://www.charon.co.uk/charoncart[/url]
    > Charon Cart 3
    > Shopping Cart Extension for Dreamweaver MX/MX 2004
    >
    >
    >
    >

    Murray *TMM* Guest

  9. #8

    Default Re: Loading a recordset at the last record?

    Hey Murray, for future reference, you could also do something like this:

    SELECT * from tablename
    WHERE primarykey = (SELECT MAX(primarykey) FROM tablename)

    The page will always execute quickly because the database returns just one
    record--the one you need--instead of the entire table.

    -Roman


    "Murray *TMM*" <forums@HAHAgreat-web-sights.com> wrote in message
    news:d5ljch$lgh$1@forums.macromedia.com...
    > Ahh - that makes sense. That's basically what Jules suggested, too.
    >
    > Thanks!
    >
    > --
    > Murray --- ICQ 71997575
    > Team Macromedia Volunteer for Dreamweaver
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    > [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    > [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    > [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    > [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    > ==================
    >
    > "David Powers" <dp@example.com> wrote in message
    > news:d5lihs$ke4$1@forums.macromedia.com...
    >> Murray *TMM* wrote:
    >>> Hmm - I don't see that in SQL, David. I'm using an Access database....
    >>
    >> How strange that it doesn't have a way to limit the number of records
    >> retrieved. Just leave off the limit clause, and select the first record.
    >> Because they're presented in descending order, the first will be the
    >> last, if you see what I mean.
    >>
    >> --
    >> David Powers
    >> Author, "Foundation PHP 5 for Flash" (friends of ED)
    >> Co-author "PHP Web Development with DW MX 2004" (Apress)
    >> [url]http://computerbookshelf.com[/url]
    >
    >

    RomanJ Guest

  10. #9

    Default Re: Loading a recordset at the last record?

    Nice - that's a great idea. Thanks, Roman!

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "RomanJ" <this@isfake.com> wrote in message
    news:d5lmpq$pgj$1@forums.macromedia.com...
    > Hey Murray, for future reference, you could also do something like this:
    >
    > SELECT * from tablename
    > WHERE primarykey = (SELECT MAX(primarykey) FROM tablename)
    >
    > The page will always execute quickly because the database returns just one
    > record--the one you need--instead of the entire table.
    >
    > -Roman
    >
    >
    > "Murray *TMM*" <forums@HAHAgreat-web-sights.com> wrote in message
    > news:d5ljch$lgh$1@forums.macromedia.com...
    >> Ahh - that makes sense. That's basically what Jules suggested, too.
    >>
    >> Thanks!
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Team Macromedia Volunteer for Dreamweaver
    >> (If you *MUST* email me, don't LAUGH when you do so!)
    >> ==================
    >> [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    >> [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    >> [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    >> [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    >> ==================
    >>
    >> "David Powers" <dp@example.com> wrote in message
    >> news:d5lihs$ke4$1@forums.macromedia.com...
    >>> Murray *TMM* wrote:
    >>>> Hmm - I don't see that in SQL, David. I'm using an Access database....
    >>>
    >>> How strange that it doesn't have a way to limit the number of records
    >>> retrieved. Just leave off the limit clause, and select the first record.
    >>> Because they're presented in descending order, the first will be the
    >>> last, if you see what I mean.
    >>>
    >>> --
    >>> David Powers
    >>> Author, "Foundation PHP 5 for Flash" (friends of ED)
    >>> Co-author "PHP Web Development with DW MX 2004" (Apress)
    >>> [url]http://computerbookshelf.com[/url]
    >>
    >>
    >
    >

    Murray *TMM* Guest

  11. #10

    Default Re: Loading a recordset at the last record?

    Access does not support 'limit 1' but does have something similar, so for Access that would be:

    SELECT top 1 * FROM mytable ORDER BY primary_key DESC

    This only returns one record in the resultset.

    --
    Marja Ribbers-de Vroed

    Internet:
    - [url]www.webwaresystems.nl[/url]
    - [url]www.clubwebware.nl[/url]
    - [url]www.flevooware.nl/dreamweaver[/url]


    "David Powers" <dp@example.com> wrote in message news:d5l4ln$4kc$1@forums.macromedia.com...
    > Murray *TMM* wrote:
    >> How can I do that? I have a table with record that are updated periodically
    >> through the day. I want a page that only loads the last record. How?
    >
    > SELECT * FROM mytable
    > ORDER BY primary_key DESC
    > LIMIT 1
    >
    > That's the MySQL way, the LIMIT clause may be different on other flavours.
    >
    > --
    > David Powers
    > Author, "Foundation PHP 5 for Flash" (friends of ED)
    > Co-author "PHP Web Development with DW MX 2004" (Apress)
    > [url]http://computerbookshelf.com[/url]
    Marja Ribbers Guest

  12. #11

    Default Re: Loading a recordset at the last record?

    Thanks, Marja!

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "Marja Ribbers" <marja@nospam.webwaresystems.nl> wrote in message
    news:d5ncqh$gr$1@forums.macromedia.com...
    Access does not support 'limit 1' but does have something similar, so for
    Access that would be:

    SELECT top 1 * FROM mytable ORDER BY primary_key DESC

    This only returns one record in the resultset.

    --
    Marja Ribbers-de Vroed

    Internet:
    - [url]www.webwaresystems.nl[/url]
    - [url]www.clubwebware.nl[/url]
    - [url]www.flevooware.nl/dreamweaver[/url]


    "David Powers" <dp@example.com> wrote in message
    news:d5l4ln$4kc$1@forums.macromedia.com...
    > Murray *TMM* wrote:
    >> How can I do that? I have a table with record that are updated
    >> periodically
    >> through the day. I want a page that only loads the last record. How?
    >
    > SELECT * FROM mytable
    > ORDER BY primary_key DESC
    > LIMIT 1
    >
    > That's the MySQL way, the LIMIT clause may be different on other flavours.
    >
    > --
    > David Powers
    > Author, "Foundation PHP 5 for Flash" (friends of ED)
    > Co-author "PHP Web Development with DW MX 2004" (Apress)
    > [url]http://computerbookshelf.com[/url]

    Murray *TMM* Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139