nvolungis Posted June 30, 2008 Share Posted June 30, 2008 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 More sharing options...
fenway Posted July 2, 2008 Share Posted July 2, 2008 Which line? Link to comment https://forums.phpfreaks.com/topic/112654-bindparam-not-working-out-so-well/#findComment-579917 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.