0

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a1039476/public_html/getdetails.php on line 69

help

<form action="getdetails.php" method="post">
Search Within:
<select name="searchtype">
<option value="CustomerID">Customer ID</option>
<option value="CustomerName">Customer Name</option>
</select> 

Search Record:
<input name="searchterm" type=”"text" size="20"/>
<input type="submit" name="submit" value="Search"/>
</form> 

<?PHP

echo "<title> *********** </title>";

$searchtype=$_POST['searchtype'];
$searchterm=trim($_POST['searchterm']);
if (!$searchtype || !$searchterm) {
echo 'Search to Get Result';
exit;
}
if (!get_magic_quotes_gpc()){
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);
} 

//Connect to Server
$connect = mysql_connect("****************,"****************","*******");
//Connecto to Database
mysql_select_db("*****");
//Query Database
$query = mysql_query("Select CustomerID,ClientName, DATE_FORMAT(EventDate, '%b %d, %Y') as EventDate, ColorMotiff, Event, Package, TIME_FORMAT(TimeStart,'%h:%i %p') as TimeStart,TIME_FORMAT(TimeEnd,'%h:%i %p') as TimeEnd, HrExt, Contact, BeefFish, Ammenities,Balance,Subtotal, AdditionalGuestIdentifier, Persons, Times,Lechon55, Lechon, BridalSuite, CocktailStation, SaladStation, DessertStation, FishFillet, Par, FollowSpot, EventLocator, Rentals, RentalFee from Details,AdditionalGuest WHERE ".$searchtype."='".$searchterm."' AND details.CustomerID=additionalguest.AdditionalGuestIdentifier and details.CustomerID=cash.ID");

echo "<table border='1'>
<tr>
<th>Client ID</th>
<th>Client Name</th>
<th>Event Date</th>
<th>Color Motiff/Theme</th>
<th>Event</th>
<th>Package</th>
<th>Time Start</th>
<th>Time End</th>
<th>Extension</th>
<th>Contact</th>
<th>Beef/Fish</th>
<th>Ammenities</th>
<th>Balance</th>
<th>Subtotal</th>
<th>Per Head</th>
<th>Guest</th>
<th>Lechon 5000</th>
<th>Lechon 6000</th>
<th>Bridal Suite</th>
<th>Cocktail Station</th>
<th>Salad Station</th>
<th>Dessert Station</th>
<th>Fish Fillet</th>
<th>PAR</th>
<th>Follow Spot</th>
<th>Event Locator</th>
<th>Rentals</th>
<th>Fee</th>
</tr>";


WHILE($rows = mysql_fetch_array($query)):

        $CustomerID = $rows['CustomerID'];
                $ClientName = $rows['ClientName'];
                $EventDate = $rows['EventDate'];
                $ColorMotiff = $rows['ColorMotiff'];
                $Event = $rows['Event'];
                $Package = $rows['Package'];
                $TimeStart = $rows['TimeStart'];
                $TimeEnd = $rows['TimeEnd'];
                $HrExt = $rows['HrExt'];
                $Contact = $rows['Contact'];
                $BeefFish = $rows['BeefFish'];
                $Ammenities = $rows['Ammenities'];
                $Balance = $rows['Balance'];
                $Subtotal = $rows['Subtotal'];
                $Persons = $rows['Persons'];
                $Times = $rows['Times'];
                $Lechon55 = $rows['Lechon55'];
                $Lechon = $rows['Lechon'];
                $BridalSuite = $rows['BridalSuite'];
                $CocktailStation = $rows['CocktailStation'];
                $SaladStation = $rows['SaladStation'];
                $DessertStation = $rows['DessertStation'];
                $FishFillet = $rows['FishFillet'];
                $Par = $rows['Par'];
                $FollowSpot = $rows['FollowSpot'];
                $EventLocator = $rows['EventLocator'];
                $Rentals = $rows['Rentals'];
                $RentalFee = $rows['RentalFee'];




  echo "<tr>";
  echo "<td>" . $CustomerID . "</td>";
  echo "<td>" . $ClientName . "</td>";
  echo "<td>" . $EventDate . "</td>";
  echo "<td>" . $ColorMotiff . "</td>";
  echo "<td>" . $Event . "</td>";
  echo "<td>" . $Package . "</td>";
  echo "<td>" . $TimeStart . "</td>";
  echo "<td>" . $TimeEnd . "</td>";
  echo "<td>" . $Contact . "</td>";
  echo "<td>" . $HrExt . "</td>";
  echo "<td>" . $BeefFish . "</td>";
  echo "<td>" . $Ammenities . "</td>";
  echo "<td>" . $Balance . "</td>";
  echo "<td>" . $Subtotal . "</td>";
  echo "<td>" . $Persons . "</td>";
  echo "<td>" . $Times . "</td>";
  echo "<td>" . $Lechon55 . "</td>";
  echo "<td>" . $Lechon . "</td>";
  echo "<td>" . $BridalSuite . "</td>";
  echo "<td>" . $CocktailStation . "</td>";
    echo "<td>" . $SaladStation . "</td>";
  echo "<td>" . $DessertStation . "</td>";
    echo "<td>" . $FishFillet . "</td>";
  echo "<td>" . $Par . "</td>";
      echo "<td>" . $FollowSpot . "</td>";
  echo "<td>" . $EventLocator . "</td>";
      echo "<td>" . $FishFillet . "</td>";
  echo "<td>" . $Rentals . "</td>";
      echo "<td>" . $RentalFee . "</td>";
  echo "</tr>";
EndWhile;


mysql_close($connect);
?>
3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by pritaeas
1

As the error message implies, there seems to be a problem with your SQL.

0

'WHILE' should be 'while'. If your SQL is correct as you say - it should work. How did you check your SQL? I suggest echoing out the query onto the screen, then copying it and pasting it to phpMyAdmin SQL window and running that.

0

diafol is right, something is wrong, otherwise you would not get this error. Do this to find out:

$query = mysql_query(...) or die(mysql_error());
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.