mysql - php submit with PDO SQL issue -


I wanted to change the PDO from the normal mysql query but since then I can not track the error back too.

Is there anyone to help me out there? Any sign will be appreciated!

Question 1: What's wrong? Question 2: How can the mistake be tracked in general?

  & lt ;? Php // If you activate the activate button, start it (isset ($ _ POST ['create'])) {$ new = htmlspecialchars ($ _ post ['newgroup']); $ Sql ​​= "Include in contact groups (status, gr_name) value (1,: new)"; $ Sql- & gt; Bindview (': new', $ new); $ Sql- & gt; Executed (); $ Arr = $ sql-> errorInfo (); Counter $ arr; Echo "& lt; meta http-equiv = \" refresh \ "content = \" 0; URL = groups.php \ "& gt;"; }? & Gt; & Lt; Form id = "group-in" method = "post" action = "groups.php" & gt; Add new distribution group: & lt; Input type = "text" name = "newgroup" placeholder = "name ..." & gt; & Lt; Input type = "submit" name = "create" value = "create new" & gt; Rename group name: & lt; Input type = "text" value = "& lt ;? php echo $ result ['gr_name'] ;; & gt; & Gt; & Lt; Input type = "submit" name = "rename" value = "rename" & gt; & Lt; / Form & gt; $ _POST is coming up, SQL is running but nothing after bindPARAM / bindVALUE ...   

You never make up your own SQL statement.

To run, you must first initialize DB and create a new PDO example. Assume that you have done this before:

  & lt ;? Start Php // if activate the activate button, start it (isset ($ _ POST ['create'])) {$ new = htmlspecialchars ($ _POST ['newgroup']); $ Sql ​​= "Include in contact groups (status, gr_name) value (1,: new)"; $ Stmt = $ db- & gt; Ready ($ sql); $ Stmt- & gt; Bindview (': new', $ new); $ Stmt- & gt; Executed (); $ Arr = $ stmt-> ErrorInfo (); Counter $ arr; Echo "& lt; meta http-equiv = \" refresh \ "content = \" 0; URL = groups.php \ "& gt;"; }? & Gt;   

You can wrap the Function / Code Bit with an attempt / catch statement and enable exception handling with PDO so that better information is found in the errors going forward.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -