Hi all,
many thanks for your replies
I tried all three SELECTS above,but to no avail.
The first SELECT came up with the message: Parse Error.syntax error,unexpected '='inC:\xampp\htdocs\harold.php on line 56.
The second line resulted in the four drop down boxes being displayed.
and the third line came up with the message
Parse Error.syntax error,unexpected '$aa=' (T_VARIABLE) inC:\xampp\htdocs\harold.php on line 56.
I am wondering if the php can't read the HTML code.
Here is the complete code and I left the three mysql SELECTS in to have a look at.
<!DOCTYPE HTML>
<html>
<body>
<select name = "author">
<option value="kendavies">ken davies</option>
<option value="arthursmith">arthur smith</option>
<option value="gillrafferty">gill rafferty</option>
<option value="mollybrown">molly brown</option>
<option value="gilbert riley">gilbert riley</option>
<option value="colinwilson">colin wilson</option>
<option value="jamesgreen">james green</option>
<option value="arnoldlaing">arnold laing</option>
<option value="cathyellis">cathy ellis</option>
<option value="carolreed">carol reed</option>
</select>
<select name = "publisher">
<option value="yonkers">yonkers</option>
<option value="blueparrot">blue parrot</option>
<option value="zoot">zoot</option>
</select>
<select name = "yearpublished">
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
</select>
<select name = "genre">
<option value="adventure">adventure</option>
<option value="thriller">thriller</option>
<option value="crime">crime</option>
<option value="biography">biography</option>
<option value="romance">romance</option>
</select>
<?php
$aa = "author";
$bb = "publisher";
$cc = "yearpublished";
$dd = "genre";
mysql_connect ("localhost","root","") or die(mysql_error());
mysql_select_db ("authors") or die(mysql_error());
//$strSQL = "SELECT * FROM books WHERE author = {$aa} AND publisher = {$bb} AND yearpublished = {$cc} AND genre ={$dd}";
$strSQL = "SELECT * from books WHERE author = '$aa' AND publisher = '$bb' AND yearpublished = '$cc' AND genre = '$dd' ";
//$strSQL = "SELECT * FROM books WHERE author = "$aa" AND publisher = "$bb" AND yearpublished = "$cc" AND genre ="$dd";
$rs = mysql_query($strSQL);
while($row = mysql_fetch_array($rs) )
{
print $row ['ID']."<br/>";
print $row ['author']."<br/>";
print $row ['booktitle']."<br/>";
print $row ['publisher']."<br/>";
print $row ['yearpublished']."<br/>";
print $row ['genre']."<br/>";
print $row ['copiessold']."<br/>";
}
mysql_close();
?>
</body>
</html>
>