SitePoint Sponsor

User Tag List

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

    Line 14... argh..

    Im running a small test database and I keep getting this error.

    Code:
    Warning: Supplied argument is not a valid MySQL result resource in /www/ause/sitename/category.php on line 14
    PHP Code:
    <?php
    include("config.php");
    include(
    "header.php");

    mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");

    mysql_select_db ($DBname);

    $websites "SELECT Catname FROM websites WHERE category='$category' and urlok='urlok'";

    $result mysql_query($websites);

    $number mysql_numrows($result);

    if (!
    $number==1) {
    print 
    "<CENTER><P>There is NO listing for this category... ( <a href=/ ><b>Back to main page</b> </a> )</CENTER>";exit;
    }
    {
    $catname mysql_result($result,0,"Catname");
    }
    I have tested this on another server and it all works fine, but not on the one I need it on. Could this server only be running php3 ?

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this


    PHP Code:
    $number mysql_num_rows($result); 
    Greets

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

  3. #3
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Peanuts, that didn't do anything to the server which I need it on.

    http://www.vbulletinsites.com/catego...y=compinternet

    Im going over the code again, but im pretty sure it's got something to do with the server.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change

    PHP Code:
    $result mysql_query($websites); 
    to

    PHP Code:
    $result mysql_query($websites) or DIE(mysql_error()); 

    Which should help you to find out exactly why the query is failing.


    Also is urlok supposed to be a variable, or is that correct with the missing dollar sign here.


    PHP Code:
    and urlok='urlok' 
    Last edited by freddydoesphp; Oct 16, 2001 at 09:50.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

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

    Thanks, It was missing the database, I had the password spelt wrong. der. I feel dumb now.

    (and urlok='urlok')
    When someone submits a link, the submittion is placed in "notok" status untill approved, then it can be added to the site by myself.

    So the pages will only pull submittions with enteries with "urlok" in them.

    Im still new at databasing, this is only my 12 days.
    Last edited by Dean Wilson; Oct 16, 2001 at 09:57.

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    mysql_select_db ($DBname); 
    to

    PHP Code:
    mysql_select_db ($DBname) or DIE(mysql_error()); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •