So here's the codeblock:
$query = "UPDATE users SET ?=? WHERE ?=?";
$type = "s";
$type .= substr(gettype($valname), 0, 1);
$type .= 'i';
if ( $smtp = $this->conn->prepare($query) )
{
$smtp->bind_param($type, $colname, $valname, 'id', 40);
$smtp->execute();
$smtp->close();
}else
{
return $this->conn->error;
}
For some reason it refuses to bind the parameters, and it gives me this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?=? WHERE ?=?' at line 1
If i add backticks ( ` ) or singlequotes ( ' ) around the questionmarks i get this error instead:
Unknown column '?' in 'where clause'
Any ideas what's gone wrong? I've been sitting here for hours playing with it, god it's frustrating!!
Thanks a bunch!