Click here to Skip to main content
15,924,317 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a tables eligibility and venue.eligibility table have multiple records i am passing using dynfields array for inserting data below is the code for inserting.Now i want to update the data.how can i do that.please help me thanks in advance.
PHP
$job_id = mysql_insert_id();
if ($_POST['dynfields']) {
           foreach ( $_POST['dynfields'] as $key=>$fieldArray ) {
                   $keys = array_keys($fieldArray);
                   $values = array_map("mysql_real_escape_string",$fieldArray);
                   $query = mysql_query("INSERT INTO `sk_c_eligibility` (".implode(',',$keys).",elg_job_id) VALUES ('".implode('\',\'',$values)."','$job_id')") or die(mysql_error());
           }
   }


What I have tried:

now i am trying to update those fields using like this.i dont know whether it should work or not .please help me.thanks in advance.

PHP
$job_id = mysql_insert_id();
if ($_POST['dynfields']) {
           foreach ( $_POST['dynfields'] as $key=>$fieldArray ) {
                   $keys = array_keys($fieldArray);
                   $values = array_map("mysql_real_escape_string",$fieldArray);
                   $query = mysql_query("UPDATE`sk_c_eligibility` SET (".implode(',',$keys).",elg_job_id) VALUES ('".implode('\',\'',$values)."','$job_id')") or die(mysql_error());
           }
   }
Posted
Updated 25-Oct-17 19:00pm
v2
Comments
Mohibur Rashid 26-Oct-17 2:12am    
Before creating post request create a json object and transfer the object,
Member 13153537 28-Oct-17 2:40am    
can u please show me any example.i am fresher i dont know about json and all.please help me thanks in advance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900