Back again with query problems and row problems
am 21.07.2009 22:39:59 von tmillerOkay I'm back guys...not sure what happened it was working..now it's all hu=
ng up...
Here are the errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result re=
source in /var/www/vhosts/getpublished.news-leader.com/httpdocs/Restur antIn=
spections/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/Restur an=
tInspections/restaurants.php on line 488
Here is the full code snippet:
=
=
=
=
=
=
// Check if page is set to show all =
if(isset($_GET['show']) && $_GET['show'] == 'all') =
{ unset($_SESSION[=
'results']); unset($_SESSION['searchna=
me']); unset($_SESSION['address']); =
=
} =
// Check if there was an empty search sent =
if(isset($_SESSION['noVarsSent'])) =
{ echo "<=
p>No values were submitted for the search.
// Unset it so a reload of page doesn't redisplay the err=
or unset($_SESSION['noVarsSent']); =
// unset($_SESSION['results']); =
} =
// Check if ful=
l 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 rang=
e if (!(isset($rangenum))) =
{ $rangenum =
=3D 1; } =
// Grab all restaurants in alphabetical order =
$sql =3D "SELECT ID, name, address, inDate, inType, notes, =
critical, cviolations, noncritical FROM restaurants, inspections WHERE rest=
aurants.name !=3D '' AND restaurants.ID =3D inspections.ID ORDER BY name;";=
$result =3D mysql_query($sql); =
//trying t=
o grab it by ranges from the db? $rows =
=3D mysql_num_rows($sql); $page_rows =
=3D 100; $last_row =3D ceil($rows/$pag=
e_rows); =
if ($rangenum < 1) { =
$rangenum =3D 1; =
} elseif ($rangenum > $last_row)=
{ =
$rangenum =3D $last_row; } =
//This se=
ts the range to display in our query $=
max =3D 'limit ' .($rangenum - 1) * $page_rows .',' .$page_rows; =
=
// Proces=
s all results into $_SESSION array =
$position =3D 1; =
while ($row =3D mysql_f=
etch_array($result)) { =
$_SESSION['fullRestaurantList'][$position] =3D $row; =
$position++; =
} =
$_SESSION['totalNumberOfRestaurants'] =3D $position; =
} =
?>
It's like 15min til 4pm here in Missouri and I am so out the door at 4..bec=
ause 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