mysql - php mysqli binding parameters -


i'm assuming php inserting single quotes around $id when binding parameters causing query fail. know $id issue because when manually put string in place of first ? query works. problem need query work using variable $id, suggestions on how can achieve this?

 if ($stmt = $mysqli->prepare("select count(1) friendships ? = (select id users username = ?) , friendstatus = ?")) {  $stmt->bind_param("sss", $id, $username,$friendstatus); $stmt->execute(); $stmt->bind_result($result); $stmt->fetch(); $stmt->close();         } 

variable column names not possible prepared statements. in general variable column names not needed made queries. consider using join instead.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -