• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

phpmysqliprepared-statement


PHP Snippet 1:

$stmt = $con->prepare('SELECT username, rank, id, steamid, avatar FROM users 
  WHERE id="$uid"');

PHP Snippet 2:

$stmt = $con->prepare('SELECT username, rank, id, steamid, avatar FROM users
  WHERE id=?');

PHP Snippet 3:

$stmt = $con->prepare('SELECT username, rank, id, steamid, avatar FROM users WHERE id = ?');

$stmt->bind_param('i', $uid);
//set parameters and execute
$uid = 'value here';
$stmt->execute();

$stmt->close();

Related Snippets

Google Gmail API - How to login programatically?

Insert And Retrieve Data in MySQL with $.post Noob Question

How to execute sql code based on fetch array

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

The sum of the user's points

How can I make this nested location configuration use the correct path to call a php program?

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

XAMPP/SQLSRV: Unable to find Sqlsrv in PHPINFO(); - errors coming from connection

PHP: PDO + CSV export not downloading (headers issue?)

Explain how this array transposing and flattening function works

Stop caching for PHP 5.5.3 in MAMP

how to hide previous markers when new markers added in google map javascript api

Detect a fetch request in PHP

Wordpress 'post_type_link' hides permalink

About Contact Privacy policy Terms and conditions