wpdb Cannot Update column in Database
-
In custom table I trying to update specific column with using $wpdb->update class and using HTML form for updating one column that have same id (in here dlname Is ID of data ).
The problem is this When I trying to update column in my table using html form The page only will Refresh
BUT When i manually set ID in codes and THEN typing and submitting new value by html form it will work like charm.
It seems to be machine cannot understand value that inputted from the form This is my code :
if(isset($_POST['btnUpdate'])){ global $wpdb; $table_name='wp_AR_tb_name'; $data_array = array( 'dstatus' => $_POST['dstatuschange'], 'downloadname' => $_POST['dlname'], ); $data_where = array('downloadname' =>'dlname'); $wpdb->update($table_name,$data_array,$data_where);
And this is my Form :
<form method="POST"> <label> Input One : </label> <input type="text" name="dlname"/> <label> Input Two : </label> <input type="text" name="dstatuschange" /> <button type="submit" name="btnUpdate"> Submit </button> </form>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘wpdb Cannot Update column in Database’ is closed to new replies.