SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Thread: Insert Into

  1. #1
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Insert Into

    Hi Gang, Im stuck and need some help.

    When someone submits some news into my script it goes into a table called "xgate_submitted", from here I want to like it (on aproval) insert it into another table which is "articles".

    Im now sure who the code should be to move things like

    sid to id and feilds that don't exist in the submitted table like counter and so on.
    Last edited by Dean Wilson; Nov 30, 2001 at 19:08.

  2. #2
    SitePoint Addict AbelaJohnB's Avatar
    Join Date
    Oct 2001
    Location
    Eureka, CA. USA
    Posts
    250
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems like it would be a LOT eaiser to just use an "approved/not approved" method by setting a switch inside of your table.

    I'm sure you have a reason for shoving stuff between two tables, but that is never a pretty thing!


    Check out: http://www.sitepointforums.com/showt...449#post303449 for a brief explanation of what I'm suggestion you do.

    Would make a lot more sense, be a lot easier, and less chance you'll lose data!



    Later
    John B. Abela
    www.JohnAbela.Com

  3. #3
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Must agree there!!! I always use a active field in the table and set it either 1 or 0 if 0 then inactive if 1 active..

    It's easy and it's save..

    Good luck
    the neigbours (free) WIFI makes it just a little more fun

  4. #4
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tryed that. Didn't work because of this factor.

    When someone submitted news it gave an id number.
    On the main page the news stories run in ORDER BY id DESC. I have tryed ordering by date but they failed every time. So creating another table and using it as a "queue" (sp?) was my other way.

    This is the only thing holding me back from making X-Gate 1.3 available for people to download.

    If you have a better option then above I would love to hear it.

  5. #5
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just thought of another way, if possible.

    Can you "UPDATE" an id feild?

  6. #6
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you mkae it real simple for yourself and order the records by id DESC, but don't actually display the id. Instead use the ordered list tag <ol> in HTML that way everything stays sequential. Just an idea.

    Sketch
    Aaron Brazell
    Technosailor



  7. #7
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't heard of "<ol>" before, is there a website about this?

  8. #8
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <OL> is ordered list. <ul> is unorderlist. The ide is that an ordered list is 1., 2., 3..... and an unorderlist is bulleted. put either tag between <li></li> tags.

    Sketch
    Aaron Brazell
    Technosailor



  9. #9
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    UK
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you mean surround them:

    Code:
    <ol type="1">
    <li>test 1
    <li>test 2
    </ol>
    e.g.:

    [list=1][*]test 1[*]test 2[/list=1]

    type="1" can be 1, a, A, i or I.

  10. #10
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you guys missed my point or I didn't explain myself the first time, probley my fault.
    Last edited by Dean Wilson; Nov 30, 2001 at 19:09.

  11. #11
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help guys, I had a play with the code today and this is how I fixed the problem.

    When someone submited some news it's added into the database without a date and with the feild "ok" set to "N", this means that it doesn't show up on the main page untill it "ok" is set to "Y". Now when I approve the news article it adds the date "NOW()" to the feild and the main page orders by date asc.

    Only hours away from realising my script. yay
    Last edited by Dean Wilson; Nov 30, 2001 at 19:14.

  12. #12
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, there's an idea... Good job!

    Sketch
    Aaron Brazell
    Technosailor



  13. #13
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I didn't think it would come to an end. One of those problems that you think will stop you in your tracks.
    Not for this little red fire engine.


Bookmarks

Posting Permissions

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