markschum Posted November 6, 2013 Share Posted November 6, 2013 I had this unning on my local apache server but when I uploaded it to the hosting site it fails with the error shown. Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /home/thusuo5/public_html/interestingthings.biz/index.php on line 77 The try except The error isnt being trapped so the warning appears on the web page with the order processed message. I have counted everything, see no spelling or punctuation errors. the website is interestingthings.biz hosted by innovision. I am trying to do this for a family member and as a learning exercise. Thanks for any help. try { $dbh = new PDO('mysql:host=localhost;dbname=orders', 'user', 'password'); /*** INSERT data ***/ /*** set up the query ***/ $qry = "INSERT INTO new(type,style,material,ring,finish,font,text,name,address, email, orderdate,ip) VALUES (:ftype,:fstyle,:fmaterial,:fring,:ffinish,:ffont,:ftext,:fname, :faddress, :fcity, fzipcode, :femail, :orderdate,:ip )"; $query = $dbh -> prepare($qry); /*** run the insert ***/ $result = $query->execute(array( ":ftype" => $ftype, ":fstyle" => $fstyle, ":fmaterial" => $fmaterial, ":fring" => $fring, ":ffinish" => $ffinish, ":ffont" => $ffont, ":ftext" => $ftext, ":fname" => $fname, ":faddress" => $faddress, ":fcity" => $fcity, ":fzipcode" => $fzipcode, ":femail" => $femail, ":orderdate" => $fdate, ":ip" => $ip )); /*** close the database connection ***/ $dbh = null; /* order placed */ $errmessage = 'your order has been placed , thanks '; // fatal error trap } catch(PDOException $e) { echo "Sorry there has been an error -". $e->getMessage() . '<br><br>'; echo "Please press the BACK button on your browser and try again "; } } Thanks again for any help. Quote Link to comment Share on other sites More sharing options...
Solution markschum Posted November 6, 2013 Author Solution Share Posted November 6, 2013 oops , sorry , I think I have it. been looking at this for too long 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.