mysql-error-1065

sprintf() Versus mysql_query()

Having trouble formatting my code to execute without error using sprintf() When I run the code I get this error: Parse error: syntax error, unexpected T_VARIABLE in /location on line 16 $query = sprintf('UPDATE `%s` SET `stock` = :amount WHERE `itemname` = '$q'', $tablename); Above is line 16 in my code. I'm assuming it is syntax rel...

PDO Uncaught Exception

This error appears when executing the code below: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in /home/content/63/6563663/html/inventory/pg.php:20 Stack trace: #0 /home/content/63/6563663/html/inventory/pg.php(20): PDOStatement->execute() ...