Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- lupa ngasi if
- */
- if($_POST){
- include('config.php');
- /*
- disini setting mysql dan koneksi terjadi
- pastikan field lebih dari 2!!
- */
- $a=explode("\n",$_POST['txt']);
- $table=trim($_POST['table']);
- foreach($a as $v)
- {
- $a2=explode("\t", $v);
- if(count($a2)<2) continue;
- $sql="insert into $table values('$a2[0]'";
- for($i=1;$i<count($a2)){
- $sql.=",\n'".trim(addslashes($a2[$i]))."'";
- }
- $sql.=")";
- //jalankan perintah sql disini
- //optional tp gw lebih suka ada.. buat laporan sampe mana
- echo "<br>input $a2[0]";
- }
- exit();
- }
- ?>
- <form action="?" method="post" enctype="multipart/form-data" target="_self" >
- BUKA XLS.. copy semua data (block) di worksheet tersebut
- <b>copy disini</b><br>
- <textarea cols="45" name='txt'></textarea>
- <br>Nama table
- <br><input type=text name=table>
- <input type="submit" name="button" id="button" value="Submit" />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement