$sql = 'SELECT id, title, text, image, alttext, date FROM news WHERE hot = :hot ORDER BY date DESC LIMIT';
$qry = $web->prepare($sql);
$qry->bindValue(':hot', 0);
$qry->execute();
Your error is on bindValue. Try this:
Code:
$server = "mysql:dbname=DBNAME;host=LOCALHOST";
$user = "root";
$pass = "";
$pdo = new PDO($server,$user,$pass);
$stmt = $pdo->prepare("SELECT id, title, text, image, alttext, date FROM news WHERE hot = :hot ORDER BY date DESC LIMIT");
$stmt->execute([
"hot" => 0
]);
while($dat = $stmt->fetch()){
$id = $dat['id'];
$title = $dat['title'];
$text = $dat['text'];
$img = $dat['image'];
$imgalt = $dat['alttext'];
$date = $dat['date'];
... and so on ...
}
?>
You dont need to bind a value with bindValue(), you can do it with ->execute([ "value" => $value ]);
It seems the variable $web is not a instance of PDO.
Just do a var_dump of that variable and check what happens, also you should remove the ":" on the first bindValue parameter.
You dont have to rewrite the code as Legithos suggested.
It seems the variable $web is not a instance of PDO.
Just do a var_dump of that variable and check what happens, also you should remove the ":" on the first bindValue parameter.
You dont have to rewrite the code as Legithos suggested.
The ":" are fine if you use named placeholder like he did in this case.
Cquery Flyff Error, someone could help me with this error? 04/06/2015 - Flyff Private Server - 3 Replies I am with this error when closing accountserver, DatabaseServer ... not save items, lvl
Print
Screenshot by Lightshot
Skype
douglas.csr
PLEASE......CAN SOMEONE CAN GIVE ME AN ENGINE THAT CAN'T BE DETECTED... 12/30/2009 - Grand Chase Hacks, Bots, Cheats & Exploits - 3 Replies ...GIVE ME AN ENGINE THAT IS N0T DETECTED..... KAHIT NA PANG 5 DAYS LANG !^^...IF YOU ARE FINISH TO READ YOU CAN CLOSED THIS THREAD....>.<:):):):):)