SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Paging Loading Issue

    Hi all,

    I have an online application which processes a Database INSERT command when a page is loaded. The command is run in a set of PHP tags that are at the top of a page and come before the all <html> tags and that.

    But, for some reason the INSERT command randomly gets runs around 2 or 3 times when the page is loaded.

    Is this at all possible?

    I know its strange, but its the I can really put my finger on the problem.

    Tryst

  2. #2
    SitePoint Evangelist figbeam's Avatar
    Join Date
    Jun 2004
    Location
    Sweden
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe the guys in the PHP forum might have a clue

  3. #3
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the mysql query in some kind of loop?

    figbeam is right, this is a PHP question, not an X/HTML question.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  4. #4
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    yeah, I know problem itself may be PHP/MySQL, but I was wondering if it was possible for the page to load itself twice, thus calling my function twice.

    No the insert is not in a loop. he weird, as it it only happens like 40% of the time.

    Tryst

  5. #5
    SitePoint Evangelist sputza's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as i know, the php engine does not process the page and output html more than once at a time.

    This is a PHP question more that xhtml, but I'm willing to help. So if post a new question in the php forum PM me the link and I'll lend a hand.

    Im going to guess that starting a session and creating an if statement to see if the session has been recorded would solve the problem.

    Im just guessing but some code would help. Thanks!
    Steven Watkins
    Chief Web Ninja
    Code Monkey Interactive
    lowgravity.ca

  6. #6
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi sputza,

    I have already started a thread on it in Mysql forum. The link is as follows...

    http://www.sitepoint.com/forums/showthread.php?t=276149

    Tryst

  7. #7
    SitePoint Evangelist sputza's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. I will check the other thread out.
    Steven Watkins
    Chief Web Ninja
    Code Monkey Interactive
    lowgravity.ca


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
  •