|
![](/images/resource/spacer.gif) |
|
การนำข้อมูลนำเข้าจาก text area มาทีละบรรทัดแล้วนำมาใช้ UPDATE |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
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;
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-05-16 07:23:16 |
By :
Chaidhanan |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 04
|