<?php
$host = "localhost";
$pass = "qwerty";
$user = "suicide676";
?>
<?php
echo "<hr>";
echo $_POST[sell] . "<br>";
echo $_POST[buy] . "<br>";
echo $_POST[city] . "<br>";
echo $_POST[area] . "<br>";
echo $_POST[price] . "<br>";
?>
<html>
<head>
<meta charset="utf-8">
<title>Фильтр</title>
<link href="style.css" type="text/css" rel="stylesheet">
<script type="text/javascript">
function disableArea(){
//alert ('disable area');
var ar = document.getElementById('area');
ar.disabled = true;
return false;
}
function disablePrice(){
//alert ('disable price');
var pr = document.getElementById('price');
pr.disabled = true;
return false;
}
function start (){
var buy = document.getElementById('buy');
var sell = document.getElementById('sell');
var area = document.getElementById('area');
var price = document.getElementById('price');
buy.onclick = disableArea;
sell.onclick = disablePrice;
}
window.onload = start;
</script>
</head>
<body>
<div id="container">
<div id="filter">
<form id="tab" method="POST" action="<?php $_SERVER['REQUEST_METHOD'] ?>">
<button id="buy" name="buy">Купить</button>
<button id="sell" name="sell">Продать</button>
<br>
<?php include('list.php'); ?>
<br>
<label>Площадь:</label>
<input type="text" name="area" id="area"></input><br>
<label>Цена:</label>
<input type="text" name="price" id="price"></input><br>
<input type="submit" value="Найти"></input><br>
</form>
</div>
<hr>
<div id="table">
<?php
include("db.php");
echo "<hr>";
?>
</div>
</div>
</body>
</html>
<?php
echo ($querySell);
$city = $_POST[city];
$area = $_POST[area];
$price1 = ($_POST[price]) + 50;
$price2 = ($_POST[prise]) - 50;
//$selectQuery = "SELECT * FROM mytable";
$connect = mysql_connect ($host, $user, $pass) or die (mysql_error());
$db = mysql_select_db("mydb", $connect) or die (mysql_error());
$result = mysql_query($querySell) or die (mysql_error());
$querySell = ('
SELECT * FROM mytable
WHERE city = '.$city.'
AND price <= '.$price1.'
AND price >= '.$price2.'
AND type = 1');
$result = mysql_query($querySell) or die (mysql_error());
$queryBuy = "
SELECT * FROM mytable
WHERE city = '$city'
AND area = '$area'
AND type = 'Купить'
;
";
echo ($querySell);
echo "<table border='1' id='tab'>";
echo "<tr>";
echo "<td>". "<b>Тип</b>" ."</td>";
echo "<td>". "<b>Город</b>" ."</td>";
echo "<td>". "<b>Площадь</b>" ."</td>";
echo "<td>". "<b>Цена</b>" ."</td>";
echo "</tr>";
while ($arr = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $arr['type'] . "</td>";
echo "<td>" . $arr['city'] . "</td>";
echo "<td>" . $arr['area'] ." S". "</td>";
echo "<td>" . $arr['price'] ." UAH". "</td>";
echo "</tr>";
}
echo "</table>";
?>
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in Z:\home\localhost\www\job\db22.php on line 16
array(0) { }
echo ($querySell);
, а он пустой. Как так?
А на 3 уровня php с моей ленью ушло почти 3 месяца.
Это знания, а опыт получаю при выполнении тестовых заданий при поиске работы.