php - Parse error: syntax error, unexpected T_IF -
i have become stuck problem week or now, , can't seem wrap head around it. put hands , admit not greatest php any highly appreciated.. trying achieve drop down menu has 3 categorys 'all', 'fencing' , 'driveways'. when selected want specific images displayed according category, , when 'all' selected display every image in table.. have mysql table set 'image' 3 columns; 'id', 'img' , 'category'.
edit: warning: mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given in /home1/wlarter/public_html/portfolio.php on line 80
while($row = mysqli_fetch_array($result))
<form action="portfolio.php" method="post"> <select onload="displayproject(this.value);" onchange="displayproject(this.value);"> <option value='none'>all</option> <option value='1'>fencing</option> <option value='2'>driveway</option> </select> </form> <?php $db = new mysqli('localhost', 'wlarter_user', 'pw', 'wlarter_portfolio'); if($db->connect_errno > 0){ die('unable connect database [' . $db->connect_error . ']'); } $option= $_post['option']; $queries = "select * image"; if ($option != 'none'){ $queries = "select * image category=".$option } $queries=$query; $result=@mysqli_query($db,"$query"); while($row = mysqli_fetch_array($result)) { ?> <div class="box-portfolio"> <?php echo $row['img']; ?> </div> <?php } mysqli_close($db); ?>
replace php code this, had syntax errors
<?php $db = new mysqli('localhost', 'wlarter_user', 'pw', 'wlarter_portfolio'); if($db->connect_errno > 0) { die('unable connect database [' . $db->connect_error . ']'); } $option= $_post['option']; $queries = "select * image"; //code updated if ($option != 'none') { $queries = "select * image category=".$option; //code updated } $queries=$query; $result=@mysqli_query($db,"$query"); while($row = mysqli_fetch_array($result)) { ?> <div class="box-portfolio"> <?php echo $row['img']; ?> </div> <?php } //code updated mysqli_close($con); ?>
Comments
Post a Comment