Advertisement
GWibisono

copy-paste excel

Aug 13th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. error_reporting(24);
  3. if($_POST['act']=='batch')
  4. {
  5.     $aItem=explode("\n",$_POST['item']);
  6.     foreach($aItem as $v)
  7.     {
  8.         if($v)
  9.         {
  10.             $a=explode("\t",$v);
  11.            
  12.             $name=trim($a[0]);
  13.             $price=trim($a[1]);
  14.             $sql="INSERT INTO  `klinik_riitem` (`item_code` ,`item_name`,item_type)
  15.     VALUES ('zzz',  '$name','14');";
  16.             $id=query($sql);$id2=sprintf("%06s",$id);
  17.             $sql="UPDATE   `klinik_riitem` SET  `item_code` =  '$id2' WHERE  
  18.             `item_id` =$id";
  19.              query($sql);
  20.             $sql="INSERT INTO   `klinik_riitemprice` (`iprice_item` ,`iprice_price`)
  21.             VALUES($id,'".intval($price)."')";
  22.             $id=query($sql);
  23.         }
  24.        
  25.     }
  26.     header('location:?option=com_ri&l=f&t=item');
  27.     print_r($_POST);
  28.     die();
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement