public function insertData_idref($db,$arr){ // ฟังกชันเพิ่มข้อมูล
global $config;
$field = $value = '';
foreach($arr AS $key=>$val){
if($field){ $field .= ', '; }
if($value){ $value .= ', '; }
$field .= $key;
$value .= "'".$val."'";
}
/*mysql_query("SET NAMES TIS620");
mysql_query("SET character_set_results=tis620"); */
$sql = "INSERT INTO ".$db." (".$field.") VALUES (".$value.")";
print "<font color='#FF0000'>FILE :: ".__FILE__." >> LINE :: ".__LINE__."</font><br/>".$sql."<br/><br/>";
$que = mysql_query($sql) or die(__FILE__.":".__LINE__.'<br>'.mysql_error().' SQL'.$sql);
// $runID = mysql_insert_id();
//return $runID; // เมนู id
}
public function updateData_agi10($db,$arr,$where){ // แก้ไขข้อมูล
global $config;
$set = '';
foreach($arr AS $key=>$val){
if($set){ $set .= ', '; }
$set .= $key."='".$val."'";
}
$sql = "UPDATE ".$db." SET ".$set." WHERE ".$where;
//echo "<font color='#FF0000'>FILE :: ".__FILE__." >> LINE :: ".__LINE__."</font><br/>".$sql."<br/><br/>";
$que = mysql_query($sql) or die('sql >> '.$sql.'<br/>'.__FILE__.":".__LINE__.'<br>'.mysql_error());
$runID = mysql_insert_id();
return $runID;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น