SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have my site setup so that it uses only one page and then uses the require() function to load the right content based on variables passed through the url and through forms. A connection to the mySQL database is established only the main pages, and not in the included files. I've been working on a new design for the last couple days or so, and I just tested it in php form and I'm getting some weird errors.

    Whenever I go to the old design at http://thunder3.cwihosting.com/~super/index.php it works fine, but when I go to the new design at http://thunder3.cwihosting.com/~super/main.php it gives me weird errors. On all of the included pages that access my mySQL database, it always gives me these errors:

    Warning: Supplied argument is not a valid MySQL result resource in maininc.php3 on line 19

    The database queries work fine on the page, main.php, but not in the included pages. By the way, the included pages are the exact same ones that are included on the index.php page. I can't figure this out at all, and all I did when I made main.php page was copy the exact php from the index.php page and change the html and graphics. I didn't change a single character in the php when I made the new design! Anyone have any ideas on what's going on?

  2. #2
    SitePoint Enthusiast Sparklit's Avatar
    Join Date
    Jul 2000
    Location
    Victoria,BC,Canada
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Check this

    Check and make sure that your new page (main.php) is selecting a database and is not calling mysql close anywhere...

  3. #3
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two most common problem with this error as I'm aware of:

    + the script connection to MySQL isn't working properly
    + the query isn't right

    So check those and since you just changed the design and not the queries, so I guess Sparklit hit the right spot.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  4. #4
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the advice, but none of those things worked. The only difference between main.php and index.php is the html and the graphics. I simply copied every piece of php code word for word to the new design. The query works fine, the connection to mySQL is working properly, and main.php is calling a database and is not calling mysql_close anywhere. I just can't figure it out. It's so weird. This happened to me a while ago with another design, and it pissed me off to the point where I just gave up on that design.

  5. #5
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems obvious to me that the maininc.php3 couldn't connect to the database. But how to fix that "obvious" error is not obvious from my side as I don't know how your include files ask for connection to MySQL.
    So now, if you add mysql_connect to the included files, it would be correct then
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  6. #6
    SitePoint Zealot JagXJ220's Avatar
    Join Date
    Mar 2001
    Location
    Not worth the drive
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the thing is, I don't want to edit all of my files to be included, because that would take a while. Could I include a file that just contains the parameters required to connect in a file, and then include the normal include file in that main page using the require() function?


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
  •