mysql - How would you load a html page with <a href="page.php?id=10">Link</a> -
this question has answer here:
ok have site dynamically load pages, seem keep failing work. can set each page tell load id display associated id, cannot can click link load id.
here have , cannot work...
<?php $server = "localhost"; $user = "username"; $pass = "password"; $dbname = "dbname"; //creating connection mysqli $conn = new mysqli($server, $user, $pass, $dbname); //checking connection if($conn->connect_error){ die("connection failed:" . $conn->connect_error); } $query = 'select * drinklist id = ?'; if($stmt = $mysqli->prepare($query)){ $stmt->bind_param('i',$id); /* execute query */ $stmt->execute(); /* result */ $result = $stmt->get_result(); /* number of rows */ $num_of_rows = $result->num_rows; while ($row = $result->fetch_assoc()) { echo "<head>"; echo "<title>".$drinklist['name']." - site</title>"; echo "<meta name='description' content='".$drinklist['description']."'>"; } /* free results */ $stmt->free_result(); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?>
error:
(line 19 =
if($stmt = $mysqli->prepare($query)){
)fatal error: call member function prepare() on non-object in /home1/link/public_html/site.com/test/inc/page.php on line 19
wiki
Comments
Post a Comment