php - How to update multiple rows with diffrent data? -
i'm using code import data excel sheet, it's work fine when import sheet first time it's insert values mysql, when change values on sheet , try import data, it's not update thing.
$query = "select positionid vacant positionid = '".$position."' , ptitle = '".$ptitle."' , location = '".$location."' , vacantd = '".$vdate."' , candidate = '".$resultcandidate."' , cv = '".$cvtorsaf."'"; $sql = mysql_query($query); if (!$sql) { // add check. die('invalid query: ' . mysql_error()); } $recresult = mysql_fetch_array($sql); $existname = $recresult["positionid"]; if($existname=="") { $inserttable= mysql_query("insert vacant (positionid, ptitle, location, vacantd, candidate, cv) values('".$position."', '".$ptitle."', '".$location."', '".$vdate."', '".$resultcandidate."', '".$cvtorsaf."');"); $msg = 'record has been added. <div style="padding:20px 0 0 0;"><a href="">go tutorial</a></div>'; } else { mysql_query("update vacant set ptitle = '".$ptitle."', location = '".$location."', vacantd = '".$vdate."', candidate = '".$resultcandidate."', cv = '".$cvtorsaf."' positionid in '".$position."'"); $msg = 'record exist. <div style="padding:20px 0 0 0;"><a href="">go tutorial</a></div>'; }
Comments
Post a Comment