|
|
|
การนำข้อมูลนำเข้าจาก text area มาทีละบรรทัดแล้วนำมาใช้ UPDATE |
|
|
|
|
|
|
|
Code (PHP)
$areaList = explode("\n", $_POST['textArea']);
$sql = "update table set score = score + 100 where id = ';
$affected_row = 0; $errormsg = '';
foreach( $areaList as $lineText){
$db->query( $sql . intval( $lineText );
if( ! $db->errno ){
$affected_row += $db->affected_rows;
}else{
$errormsg = $db->error . "<br>" . $sql . $lineText . "<br>";
}
}
echo 'complete = ' , $affected_row , ' rows<br>', 'error <br>', $errormsg;
|
|
|
|
|
Date :
2015-05-16 07:23:16 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|