SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: max_questions

  1. #1
    SitePoint Member
    Join Date
    Feb 2006
    0 Post(s)
    0 Thread(s)


    I am pretty new to MySQL and databases in general, so please forgive me if this is a stupid question. I recently purchased the Sitepoint book Build Your Own Database Driven Website Using PHP & MySQL and have read through it and started a website with some database features in it.

    My company publishes a lot of press releases, and prior to me accepting the webmaster position they had a ColdFusion/Access database that was created by another company, but when I took the position I ported it over to MySQL and PHP and using the book as a reference I created a CMS and visitor display page that lists all the press releases in the database and allows them to click on the title of the release to get the full article. ORDA Newsroom if it actually works now..

    It worked perfect for about a month and a half, however Friday I started receiving an error "User 'whitefac_admin' has exceeded the 'max_questions' resource (current value: 50000)", which with some research I have figured this means that there has been more than 50,000 queries to the database in less than an hour. I can't figure out where all these queries are coming from. Looking at the site stats, the page newsroom.php hasn't been viewed more than 200 times a month, including the full article displays, and there are only approx. 145 entries in the db.

    So, I guess my question is: How can I tell how many queries there are to the database?

    The code I use for the db access is the same as used in the book, but basically it is this:
    Connect to DB
    Select Table
    $results = mysql_query(SELECT whatever FROM table)
    while ($result = mysql_fetch_array($results))
    pull info from array
    echo the information in paragraph tags

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Tampa, FL (US)
    1 Post(s)
    0 Thread(s)
    as-is, you can't. the simplest thing to do is write a replacement function for mysql_query() that logs the query to a text file, then executes the query and returns the result. then do a global search-and-replace on mysql_query(). visit each page once and you'll have a complete listing of the number of queries run from each page.


Posting Permissions

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