html - CRUD'ding with PHP and Oracle -


I am trying to create a form that updates user information stored in the Oracle database, not updating properly I am going and I can not see any problem because I have been presenting SQL in Oracle and it all checks out.

Here is a php that takes the form of a connection:

  & lt ;? Select Php $ sql = "Select from Member * where Member ID =". Get $ _ ["member"]; $ Conn = oci_connect ("user", "pass", "conn"); $ Stmt = oci_parse ($ conn, $ sql); Oci_execute ($ stmt); $ Line = oci_fetch_row ($ stmt); Oci_free_statement ($ stmt); Oci_close ($ Conn); ? & Gt;  

Here is the form of an example or two forms:

  & lt; Div class = "topwrapper" & gt; & Lt; Img src = "Logo .png" alt = "Peak Park Sailing Club" & gt; & Lt; / Div & gt; & Lt; Form name = "form1" method = "post" action = "editmemhandler.php" & gt; & Lt; Input name = "MemberID" type = hidden id = "member_ide" value = & lt ;? Php print $ line [0] ;? & Gt; & Gt; & Lt; Table class = "infestible" & gt; & Lt; TR & gt; & Lt; Td> & Lt; Strong & gt; Member ID & lt; / Strong> & Lt; / Td> & Lt; Td> & Lt; Input name = "memberid" type = "text" id = "memberid" value = & lt ;? Php print $ line [0] ;? & Gt; & Gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Strong & gt; First name & lt; / Strong> & Lt; / Td> & Lt; Td> & Lt; Input name = "firstname" type = "text" id = "firstname" value =  & Lt; / TR & gt;  

and handler PHP here:

  "; Print $ sql; Oci_free_statement ($ stmt); Oci_close ($ Conn); ? & Gt;  

I'm very new to php and I'm experimenting with Oracle, so this is likely to be something obvious ...

Thanks advance!

Bob P

Try it out:

  $ Conn = oci_connect ("user", "pass", "conn"); $ Sql ​​= "Update Member SET firstname =: firstname, lastname =: lastname, dob =: dob, membertype =: membertype, groupid =: groupid, houseno =: houseno, street =: road, city = city, county =: County, Postcode =: Postcode where Member =: Member; "; $ Stmt = oci_parse ($ conn, $ update); Oci_bind_by_name ($ stmt, ': first name', $ firstname); Oci_bind_by_name ($ stmt, ': lastname', $ lastname); Oci_bind_by_name ($ stmt, ': dob', $ dob); Oci_bind_by_name ($ stmt, ': member type', $ member type); Oci_bind_by_name ($ stmt, ': grouping', $ group id); Oci_bind_by_name ($ stmt, ': houseno', $ houseno); Oci_bind_by_name ($ stmt, ': street', $ road); Oci_bind_by_name ($ stmt, ': county', $ county); Oci_bind_by_name ($ stmt, ': postcode', $ postcode); Oci_bind_by_name ($ stmt, ': member', $ member); $ Result = oci_execute ($ stmt, OCI_DEFAULT); If (! $ Result) {echo oci_error (); } Oci_commit ($ conn);  

This way of working minimizes your SQL injection. I had written it out of my head..what was the chance to test it, because I do not have Oracle DB for it but try it.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -