>Error trapping is not really relevant here as the server is properly
configured so the errors are going to show up in either event. In fact,
using the die() >function on my server just makes thing worse.

it'll definitely make it worse, but hopefully only to find the problem and
make it better.  you should be able to find the query on which this is not
a     valid resource run that agains't mysql and find out why its failing,
if you can't see that from $qry being in die().  but yes, a bad idea in
production.       send the output to a file on error and see what your
getting.the error that you want is from mysql_query, the error that you're
showing is from mysql_fetch_array(), so if the server is configured to show
them elsewhere then the answer should be right before the error below


In any case, the var_dump was a good idea as I was able to find out that
what is happening is when this loops up after the first run through the
array is blank. It doesn't reinitialize the array with the new values. As
far as the $cat, or any of the other variables go, they're always the same
when returning to he index. Whether I initialize them from the query
string, or in the index itself as in the case when it is loaded without any
parameters. The question is, why wouldn't the array be redefined on the
second loop? Hell if I know.



            When returning to the main page of my script sometimes I'll get
            following error:

            Warning: mysql_fetch_array(): 8 is not a valid MySQL result
            resource in
            /home/nick/http/search/includes/main.inc on line 13

            This happens only AFTER the first element in the resource has
            processed. Here's the code that is causing the problem:

      First, i'd place an... or die (mysql_error()) after your mysql call.
      you can see what mysql is complaining about.  basically your sql is
      failing.  I also like to split the first two items, when debegging,
      to see
      what the actual query was.  i.e.
      $qry = "SELECT * FROM categories WHERE length(cat)='2'";
      $s = mysql_query($qry) or die (mysql_error() . "\n"<br>" . $qry .

      The only time i saw the error on your page the 'cat' GET variable was
      defined as 0.  Is this really a static query like below, or is it
      based on
      what is passed to the page in the query string?  The URL when it
      which to
      me looks like a bad querystring, but may indeed be valid values.

      If that doesn't lend itself to any useful information, try
      var_dump($t); in
      your while loop, to see what has been processed and what is failing.


            $s = mysql_query("SELECT * FROM categories WHERE
            while($t = mysql_fetch_array($s)){>    $cat = $t["cat"];
               $name = $t["name"];
               if($tstruc == $dirwidth){>        echo "</tr><tr>";
                   $tstruc = 0;
               echo "<td align=\"left\" valign=\"top\"><font
            serif,helvetica\" size=\"3\"><b><a

               $subcat = mysql_unbuffered_query("SELECT * FROM categories
            length(cat)='4' && substring(cat,1,2)='$cat' ORDER BY cat");
               while($ct = mysql_fetch_array($subcat)){>        $scats

      = $ct["name"];

                   $dcats = $dcats . $scats . ", " ;
               $dcats = trim(substr($dcats, 0, 28)) . trim("...");
               if($dcats != "..."){>        echo "<br><font face
            = \"tahoma,sans


            size=\"1\">" . $dcats . "</font>";
               $dcats = "";
               echo "</td>";

            You can go to the site http://www.icesource.com to see this
            script in
            action. This is an intermittent problem so you may not see it
            at the
            site, but it does happen there sometimes. If you click on one
            of the
            categories on the list there, and to two or three deep, then
            hit the
            Home link at the top left of the listings there's a pretty good
            you'll see the problem. I've been trying to figure this out for
            a long
            time, and nothing seems to work. Any ideas out there would be


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to