<html> <head> <title>Read CSV & MSSQL </title> </head> <body> <br> <input type="file" id="files" name="file" /> <span class="readBytesButtons"> <button>entire file</button> <?php $objCSV = fopen("scan.csv", "r"); //scan.csv ?> <?php $objConnect = mssql_connect("192.168.xxx.x","name","pass") or die("Error Connect to Database"); $objDB = mssql_select_db("ITREPORT"); //$strSQL = "SELECT * FROM view_stocklist"; //$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]"); //while($arrayData[] = mssql_fetch_array($objQuery)){ } ?> <table width="600" border="1"> <tr> <th width="501"> <div align="center">UID NEW </div></th> <th width="98"> <div align="center">QTY NEW </div></th> <th width="198"> <div align="center">NOTE </div></th> <th width="97"> <div align="center">Time/Date </div></th> <th width="41"> <div align="center">UID </div></th> <th width="91"> <div align="center">PARTNUMBER </div></th> <th width="90"> <div align="center">PARTNUMBER_PO </div></th> <th width="18"> <div align="center">SERIAL_NO </div></th> <th width="92"> <div align="center">RESERVED </div></th> <th width="59"> <div align="center">DESCRIPTN </div></th> <th width="51"> <div align="center">WHCODE </div></th> <th width="60"> <div align="center">LOCATION </div></th> <th width="74"> <div align="center">QTY </div></th> <th width="87"> <div align="center">UM </div></th> <th width="11"> <div align="center">COND </div></th> <th width="85"> <div align="center">TRANSPORT </div></th> <th width="99"> <div align="center">INHOUSE_QA </div></th> <th width="108"> <div align="center">BOOKED </div></th> </tr> <?php $index=0; while (($objArr = fgetcsv($objCSV, 1000, ",")) !== FALSE) { ?> <tr> <td><div align="center"><?php echo $objArr[0];?></div></td> <td><?php echo $objArr[1];?></td> <td><?php echo $objArr[2];?></td> <td><div align="center"><?php echo $objArr[3];?></div></td> <?php $strSQL = "SELECT * FROM view_stocklist where UID='{$objArr[0]}'"; $objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]"); $arrayData = mssql_fetch_array($objQuery); ?> <td><div align="center"><?php echo $arrayData["UID"];?></div></td> <td><div align="center"><?php echo $arrayData["PARTNUMBER"];?></div></td> <td><?php echo $arrayData["PARTNUMBER_PO"];?></td> <td><?php echo $arrayData["SERIAL_NO"];?></td> <td><div align="center"><?php echo $arrayData["RESERVED"];?></div></td> <td align="right"><?php echo $arrayData["DESCRIPTN"];?></td> <td align="right"><?php echo $arrayData["WHCODE"];?></td> <td align="right"><?php echo $arrayData["LOCATION"];?></td> <td align="right"><?php echo $arrayData["QTY"];?></td> <td align="right"><?php echo $arrayData["UM"];?></td> <td align="right"><?php echo $arrayData["COND"];?></td> <td align="right"><?php echo $arrayData["TRANSPORT"];?></td> <td align="right"><?php echo $arrayData["INHOUSE_QA"];?></td> <td align="right"><?php echo $arrayData["BOOKED"];?></td> </tr> <?php ++$index; } ?> </table> </body> </html
<br> <input type="file" id="files" name="file" /> <span class="readBytesButtons"> <button>entire file</button> <?php $objCSV = fopen("scan.csv", "r"); //scan.csv ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง