Jump to content

bindParam() not working out so well.


nvolungis

Recommended Posts

I'm using

MYSQL v 5.0.51a

PHP v 5.2.5

 

I get this error:

 

Error: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

 

which is generated when I run this code:

 

$Index_in = 7;

$Last_in = 'Hanks';

$First_in = 'James';

try

{

$dbh = new PDO($dsn, $user, $password);

$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sql ='INSERT INTO `Table` (Index, Last, First)

VALUES (:Index_in, :Last_in, :First_in)';

$stmt = $dbh->prepare($sql);

$stmt-> bindParam(':Index', $Index_in);

$stmt-> bindParam(':Last', $Last_in);

$stmt-> bindParam(':First', $First_in);

$stmt-> execute();

}

 

I'm learning and this looks analogus to the book's example.

Any Ideas?

Link to comment
https://forums.phpfreaks.com/topic/112654-bindparam-not-working-out-so-well/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.