New to PHP
Posted: Mon Jan 21, 2008 12:16 pm
Ok first if I have posted in wrong section sorry.... Hi new to php and looking for some general help with code I am writing for a project I have to do and I have ran into some problems with the code and have been getting errors.. and well dont know were to turn so looking for any help to point out the fault in my code. Here is the code I have written....errors are happening on line 24 and if I change the the code I then get error on line 33 at the echo any help please.
Code: Select all
<?php
$dbconnection = mysql_connect("","","");
if (!$dbconnection)
{
die('Unable to connect … ' . mysql_error());
}
mysql_select_db("car_dealer", $dbconnection);
/*//This is the original code*/
/*//$query = mysql_query("SELECT * FROM cars where make = 'ford'");
$query = mysql_query("SELECT * FROM cars where make LIKE '".$_POST['frmmake']."' AND price <=".$_POST['frmprice']." AND enginesize >= ".$_POST['frmenginesize']." AND transmision ='".$_POST[frmtransmission]."' AND fuel ='". $_POST['frmfuel']."'"); */
//$query = mysql_query("SELECT * FROM cars where make = 'ford'");
$query = mysql_query("SELECT * FROM cars where make LIKE '".$_POST['frmmake']."' AND price <=".$_POST['frmprice']."'AND engine_capacity >=".$_POST['frmengine_capacity'].AND "transmission ='".$_POST[frmtransmission]."'AND fuel ='".$_POST['frmfuel']."'");
//$query = mysql_query("SELECT * FROM cars");
echo $query;
while($row = mysql_fetch_array($query))
{
//echo $row['make']. " " .$row['model'] . "£" . $row['price'];
echo "<br />";
}
mysql_close($dbconnection);
?>