Back again with query problems and row problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay I'm back guys...not sure what happened it was working..now it's all hung up...
Here are the errors:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/getpublished.news-leader.com/httpdocs/ResturantInspections/restaurants.php on line 464

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/getpublished.news-leader.com/httpdocs/ResturantInspections/restaurants.php on line 488



Here is the full code snippet:

                                                                <?php                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 // Check if page is set to show all                                    if(isset($_GET['show']) && $_GET['show'] == 'all')                                    {                                      unset($_SESSION['results']);                                      unset($_SESSION['searchname']);                                      unset($_SESSION['address']);                                                                                                               }                                                                        // Check if there was an empty search sent                                    if(isset($_SESSION['noVarsSent']))                                    {                                      echo "<p><b>No values were submitted for the search.</b></p>";                                      // Unset it so a reload of page doesn't redisplay the error                                      unset($_SESSION['noVarsSent']);                                      // unset($_SESSION['results']);                                    }                                                                                                            // Check if full list of restaurants has been created and stored yet                                    // Store full results in $_SESSION to limit database hits                                    if(!isset($_SESSION['fullRestaurantList']))                                    {                                      // List not grabbed yet, so run query and store in $_SESSION                                                                          //check for range                                    if (!(isset($rangenum)))                                      {                                      $rangenum = 1;                                      }                                      // Grab all restaurants in alphabetical order                                      $sql = "SELECT ID, name, address, inDate, inType, notes, critical, cviolations, noncritical FROM restaurants, inspections WHERE restaurants.name != '' AND restaurants.ID = inspections.ID ORDER BY name;";                                      $result = mysql_query($sql);                                                                        //trying to grab it by ranges from the db?                                     $rows = mysql_num_rows($sql);                                      $page_rows = 100;                                      $last_row = ceil($rows/$page_rows);                                                                            if ($rangenum < 1)                                    {                                      $rangenum = 1;                                      }                                      elseif ($rangenum > $last_row)                                      {                                      $rangenum = $last_row;                                      }                                                                            //This sets the range to display in our query                                      $max = 'limit ' .($rangenum - 1) * $page_rows .',' .$page_rows;                                                                                                                                                        // Process all results into $_SESSION array                                                                            $position = 1;                                                                            while ($row = mysql_fetch_array($result))                                      {                                      $_SESSION['fullRestaurantList'][$position] = $row;                                      $position++;                                      }                                                                            $_SESSION['totalNumberOfRestaurants'] = $position;                                                                          }                                  ?>

It's like 15min til 4pm here in Missouri and I am so out the door at 4..because this has been one long frustrating day..and this girl needs a beer.....or two.
Talk to you all tomorrow!
Terion

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux