I am trying to update the record from which I found out that if I were to investigate- for example, now I have 4 upload buttons inside my form If the document is attached, there will be no upload button. But it has been updated for the database, it will show errors because the user did not attach any documents. Maybe I will explain in my code and give a clear picture.
Code for my form: & lt; Form id = "update" action = "update.php" & gt; // // code for all upload and download buttons is repeated, just a test, assign and paper & lt ;? For Php if ($ enclosed == "no") is {echo "and select name name = \" test \ "id = \" test \ "& gt;"; Echo "& lt; option value = \" no \ "selected = \" selected \ "& gt; not & lt; / option & gt;"; Echo "& lt; input name = \" attached [test] \ "id = \" test \ "type = \" file \ "/>; Echo "& lt; / select & gt;"; } Else {button to download the document at $ fullpath = "./documents/."$Test"; "echo" input type = \ "hidden \" name = \ "full path \" value = \ "$ fullpath \ "/"; "Echo" input type = \ "submit \" name = \ "download \" value = \ "download \" /> ";}?" & Gt; & lt; / form & gt; ; Update.php code: / / So if I want to update my database in SQL 3, then I have to check it as follows: $ test = $ _POST ['Attached [Test]']; $ id = 1; $ db = = New PDO ('SQLite: database / test $ ($ Test! = "") {$ Update = $ DB- & gt; Ready (test test test ?, assign?, Papers =?); $ Execute = $ update - & Execute ($ test, $ assign, $ paper); else if ($ test == $ test) {$ update = $ DB- & gt; Ready ('Set up Update Test Setting = ?, Paper =? Where id =?); $ Execution = $ update- & gt; execute (array ($ $, $ paper));} and {moveloaded_files ();} So my question is how do I reduce my ife-else statement Awareness that personal values to check if the database already exists in and not to update that particular column (updates). Please code for my form:
& lt; Form id = ks "update" action = "update.php" & gt; & Lt ;? Php if ($ enclosed == "no") {echo "select name = \" test \ "id = \" test \ "& gt;"; Echo "& lt; option value = \" no \ "selected = \" selected \ "& gt; not & lt; / option & gt;"; Echo "& lt; input name = \" attached [test] \ "id = \" test \ "type = \" file \ "/>; Echo "& lt; / select & gt;"; } Else {button "echo" input type = \ "submit \" name = \ "download \" value = \ "download \" /> to download the document. ";}? & Gt; & lt; / form & gt; Update.php code:
& lt ;? php $ test = $ _POST ['Attached [Test]']; $ db = New PDO ('Esquite: Database / Test .db'); If (! Empty ($ Test)) {$ update = $ DB- & gt; Ready (test Test test?, Allocate =?, Papers =? WHERE idk = you tell me '); $ Execute = $ update-> (Array ($ test, $ assign, $ paper));} Else {Moveuploaded_files ();}? & Gt; Use blank ()
You do not need a $ test == $ test case, because F so, it will still be updated.
Comments
Post a Comment