A little help.

Hey guys nice to find a forum like this!

Have been working on a search form / results page for a while now and have come to the point where I do not know whats up. have correctly used $_GET in the form and that value is passed to the results page.

my code.

<?php require_once('includes/conn.inc.php'); if(isset($_GET['search'])){ $eventName = "%".$_GET['search']."%"; }else{ $eventName = "none"; } $sql= "SELECT * FROM concerts, movies, theatre WHERE ((`concerts`.`concertName` LIKE :eventName) AND (`movies`.`movieName` LIKE :eventName) AND (`theatre`.`theatreName` LIKE :eventName))"; $stmt = $mysqli->prepare($sql); $stmt->bindParam(':eventName', $eventName, PDO::PARAM_STR); $stmt->execute(); $total = $stmt->rowCount(); while ($row = $stmt->fetchObject()) { echo $row->eventName; } ?>

I am getting the error Fatal error: Call to a member function bindParam() on a non-object and do not know where to go from here although am suspicious it is to do with the prepare statement.

In that case heres my connection file.

<?php $hostname = "localhost"; $username = "root"; $password = ""; $database = "b1042507"; $mysqli = new mysqli($hostname, $username, $password, $database); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } ?>

If there is anything you guys know to help would you kindly take a quick look,

Thanks a bunch,

Andy

Sponsor our Newsletter | Privacy Policy | Terms of Service