Freid001 Posted May 28, 2013 Share Posted May 28, 2013 (edited) Not sure what is wrong here: $query = "INSERT INTO `*******`(`account`, `capital`, `image`, `government`, `oil`, `wood`, `copper`, `iron`, `steel`, `titanium`) VALUES(:account, :capital, :image, :government, :oil, :wood, :copper, :iron, :steel, :titanium)"; $statement = $db->prepare($query); $statement->execute(array(':account' => $user, ':capital' => $capital, ':image' => $image, ':government' => $government, ':oil' => $oil, ':wood' => $wood, ':cooper' => $copper, ':iron' => $iron, ':steel' => $steel, ':titanium' => $titanium)); THIS IS THE ERROR I GET: Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in/srv/disk5/657046/www/worldwarfare-v3.atwebpages.com/pages/registration/registration_script.php on line 175 Thanks for any help Edited May 28, 2013 by Freid001 Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 28, 2013 Share Posted May 28, 2013 cooper != copper. You should normalize that table. Quote Link to comment Share on other sites More sharing options...
Freid001 Posted May 28, 2013 Author Share Posted May 28, 2013 Arh, cool thx mist that. How would I normalize the table? Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 28, 2013 Share Posted May 28, 2013 You missed it. Mist is when you have water in a fine spray. Google "normalize your data". Quote Link to comment Share on other sites More sharing options...
Freid001 Posted May 28, 2013 Author Share Posted May 28, 2013 Ok so no errors show up now. However i'm not sure if the query is being run because nothing gets inserted in to the database. I have checked that it is the correct table name and everything, so not sure why it is not inserting in to the table. Any ideas, or help? Quote Link to comment Share on other sites More sharing options...
Freid001 Posted May 29, 2013 Author Share Posted May 29, 2013 (edited) Not sure why but its like the code is not being executed or something, any ideas? $query = "INSERT INTO `*******`(`account`, `capital`, `image`, `government`, `oil`, `wood`, `copper`, `iron`, `steel`, `titanium`) VALUES(:account, :capital, :image, :government, :oil, :wood, :copper, :iron, :steel, :titanium)"; $statement = $db->prepare($query); $statement->execute(array(':account' => $user, ':capital' => $capital, ':image' => $image, ':government' => $government, ':oil' => $oil, ':wood' => $wood, ':copper' => $copper, ':iron' => $iron, ':steel' => $steel, ':titanium' => $titanium)); Edited May 29, 2013 by Freid001 Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 29, 2013 Share Posted May 29, 2013 (edited) Try capturing errors. Check my signature where it says Debugging your SQL. You're not checking for any MySQL errors. Edit: The post describes using mysqli, but you'll do the same thing with the appropriate PDO functions. Check the PHP manual for those. Edited May 29, 2013 by Jessica Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.