php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -


i have php code pulls info database. uses prepared statement, works fine written below:

<?php  $n = '5';  if ($stmt = $connection->prepare("select title items id = ?")) {     $stmt->bind_param("s", $n);     $stmt->execute();     $stmt->bind_result($title);     while ($stmt->fetch())     {         echo $title;     }     $stmt->close(); } ?> 

and let's echo "batman".

however, when move placeholder here:

"select ? items id = 5" 

and change:

$n = 'title'; 

instead of echoing "batman", echoes "title". not possible use placeholder select parameter?

what have done this:

select "title" items id = 5 

you cant use prepared statement bindings identifiers, parameters.


Comments

  1. Thanks for sharing information. Your writing skills is good . I Loved Your writing. Please Kindly check My web: Cyber Security Devices

    ReplyDelete

Post a Comment

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -