Hi everybody,
I'm having trouble with my query on line 19. I'm supposed to search for a name and return the balance and credit limit. I'm not sure why I keep getting a parse error.
Thanks in advance!
<?php
$find=$_POST['find'];
$name=trim($_POST['name']);
if (!$name) {
echo 'You have not entered a name. Please go back and try again.';
exit;
}
$db = mysql_connect();
mysql_select_db("Premiere", $db);
if (!$db) {
die('Could not connect to the database, error # ' . mysql_error() );
} else
echo 'The mysql_connect succeeded'."<br />";
if ($find == a) {
$query = "SELECT BALANCE, CREDIT_LIMIT FROM CUSTOMER WHERE ".$find" LIKE '%".$name."%'";
} if ($find == b){
$query = "SELECT * FROM ORDER, CUSTOMER WHERE ".$find" LIKE '%".$name."%'" AND CUSTOMER.CUSTOMER_NUM = ORDER.CUSTOMER_NUM;
} else
echo 'Match could not be found';
$result = mysql_query($query, $db);
$num_results = mysql_num_rows($result);
echo "<p>Number of results found: ".$num_results."</p>";
if ($find == a) {
for ($i=0; $i < $num_results; $i++) {
$row = mysql_fetch_assoc($result);
echo "<p>".($i+1).". Name: ";
echo $name;
echo "<br />Balance: ";
echo $row['BALANCE'];
echo "<br />Credit Limit: ";
echo $row['CREDIT_LIMIT'];
echo "</p>";
}
} else
for ($i=0; $i < $num_results; $i++) {
$row = mysql_fetch_assoc($results);
echo "<p>".($i+1).". Name: ";
echo $name;
echo "<br />Orders: ";
echo $row['ORDER'];
echo "</p>";
}
mysql_free_result($result);
mysql_close($db);
?>
</body>
</html>