0

Is it possible to update one table with 2 queries.

 $imp_feature=$_POST["imp_feature"];

   $project_data=array( 
      "feat"=> $imp_feature
   );

    $db->where("post_project_id",$proj_id);
    $project_id=$db->update("post_project",$project_data);

   $del_feature=$_POST["del_feature"];
    
   $projects_array=array(
        "feat"=> $del_feature
   );
     
   $db->where("post_project_id",$proj_id);
   $project_result=$db->update("post_project",$projects_array);

I tried but failed.if it is possible then tell me how

nomi
  • 33
  • 5
  • 3
    _I tried but failed_.. What failed? You got an error, if yes, what error? Please read [How do I ask a good question](https://stackoverflow.com/help/how-to-ask). Info on the database would also be useful, please read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – geertjanknapen Feb 15 '23 at 09:06
  • not getting error.but its not updating both.its only updating against one query – nomi Feb 15 '23 at 09:07
  • 3
    Yes, you can update a table more than once. Please note that we don't know what the symptoms are, what your functions do, what your input is or what your tables look like. – Álvaro González Feb 15 '23 at 09:17
  • 1
    You should be able to see the number of affected rows: [How do I tell when a MySQL UPDATE was successful versus actually updated data?](https://stackoverflow.com/questions/7368225/how-do-i-tell-when-a-mysql-update-was-successful-versus-actually-updated-data) – Peter Krebs Feb 15 '23 at 09:21

0 Answers0