SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to write Php / MySQL command that tells wait for answer from MySQL for 5 sec only

    Hello,

    Can one and if yes how can one write a Php MySQL command that tells Php

    SELECT this command from MySQL
    but if it takes more than 5 Seconds to get an answer from MySQL regarding this
    SELECT then stop waiting for it and instead return 0 (or X) and go on to the
    next command.

    ThanX

    Anoox search engine volunteer

    www.anoox.com

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    no, i don't think so, no
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Are you sure that the answer is NO!
    I had read a few places online that there is a way to do this, but they were just not clear.



    Quote Originally Posted by r937 View Post
    no, i don't think so, no

    Anoox search engine volunteer

    www.anoox.com

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,808
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    @WorldNews

    Your question is far too general and would be better if you could give more details of your search.

    If you are looking to search for a phrase then a method I have used:

    1. split the phrase into a SEARCH array

    2. loop through the search array and seek each word
    3. if found then add to a FOUND array
    4. repeat until endof SEARCH array

    5. display results of FOUND array

  5. #5
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Thanks for your suggestions.
    But the issue is not that simple.
    And really only away around it is if Php MySQL had a command which would allow for a certain
    amount of time of a wait for an answer to come back and if none has come back in that X time
    then for that SELECT to abort and move on to the next command (line), rather than hang the
    whole program when a given server does not respond to a SELECT command.


    Quote Originally Posted by John_Betong View Post
    @WorldNews
    Your question is far too general and would be better if you could give more details of your search.

    If you are looking to search for a phrase then a method I have used:

    1. split the phrase into a SEARCH array

    2. loop through the search array and seek each word
    3. if found then add to a FOUND array
    4. repeat until endof SEARCH array

    5. display results of FOUND array

    Anoox search engine volunteer

    www.anoox.com

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by WorldNews View Post
    Thanks for your suggestions.
    But the issue is not that simple.
    i think he must have been trying to reply to some other thread
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,808
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by r937 View Post
    i think he must have been trying to reply to some other thread
    Actually I was not replying to another thread and still maintain that a query should be simplified and the results used to create a more complex query.

    I would still like to know further details of the failed query that requires aborting after 5 seconds.


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
  •