Ok, it doesn't like my query statement. Here is what I have:
/********************* Begin Query for Owners Form ***************************/
$SubmitOwners= $_POST['SubmitOwners'];
$AlterSearch= $_POST['AlterSearch']; // search again with same values initially in form
$NewSearch= $_POST['NewSearch']; // clear form
if($NewSearch)
{
$ownerid = "";
$last = "";
$first = "";
$city = "";
$state = "";
$zip = "";
$hidden = "";
}
else // all empty
{
$ownerid = $HTTP_POST_VARS['OwnerID'];
$last = $HTTP_POST_VARS['LastName'];
$first = $HTTP_POST_VARS['FirstName'];
$city = $HTTP_POST_VARS['City'];
$state = $HTTP_POST_VARS['State'];
$zip = $HTTP_POST_VARS['Zip'];
$hidden = $HTTP_POST_VARS['hidden'];
}
...blah...
$form_filled= $ownerid . $last . $first . $city . $state . $zip . $hidden;
//echo "[$form_filled]<br>";
if(!$SubmitOwners or !$form_filled) // to allow Show All remove the or ...
{
// Show the search form
...blah...
<form name="Owners" id="Owners" method="post" enctype="application/x-www-form-urlencoded" action="<?php echo $PHP_SELF; ?>">
<?
include 'report_admin_table_form.php';
?>
...blah...
}
else
{ // show any results
$query_owners = "SELECT * FROM $own ORDER BY $order DESC WHERE 1 ";
// if the OwnerID has a value
if ($_POST['OwnerID']){
$query_owners = $query_owners." and OwnerID LIKE '$ownerid%'";
}
// if the LastName has a value
if ($_POST['LastName']){
$query_owners = $query_owners." and LastName LIKE '$last%'";
}
// if the first name has a value
if ($_POST['FirstName']){
$query_owners = $query_owners." and FirstName LIKE '$first%'";
}
// if the City has a value
if ($_POST['City']){
$query_owners = $query_owners." and City LIKE '$city%'";
}
//if State has a value
if ($_POST['State']){
$query_owners = $query_owners. " and State = '$state'";
}
// if the Zip has a value
if ($_POST['Zip']){
$query_owners = $query_owners." and Zip LIKE '$zip%'";
}
// if the hidden has value
if ($_POST['hidden']){
$query_owners = $query_owners." and hidden LIKE '$hidden%'";
}
//run the query
$result_owner = mysql_query($query_owners);
$results= mysql_numrows($result_owner); //LINE 299
$item= 0;
And this is my function, which is located in sort.php:
<?php header("location: report_admin_html_nu.php?order=$order"); ?>
<?php
function Order ($order) {
$order = "OwnerID";
$order = "LastName";
$order = "FirstName";
$order = "City";
$order = "State";
$order = "Zip";
$order = "hidden";
return $order;
}
?>
When I run the query I get this error:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/hagerstown1/www/HagerstownCemetery/report_admin_html_nu.php on line 299
All of my variables are passed from the include files.
π