我終於有了一個條形碼出現在我的表中,這是從Query生成的。但是現在我遇到了一個問題,從$ row [1]得到每個結果的代碼。我試圖使用PHP-BARCODE,但它需要太多內存來創建所有條形碼。 Jquery看起來像使用更少的內存來創建它們。因此我選擇了這種方法。JQuery條碼僅從查詢結果中生成一個條碼
任何幫助將真棒
我的劇本主要是PHP與JQUERY一個奇怪的轟動。用於屏幕刷新和條形碼生成的JQUERY。有一次,我越過了這個障礙。
<?php
include('inc/database.php');
// MSSQL Query
$sql = "SELECT warehouse, pick_order_number, order_status, pick_order_type, customer_order_number
FROM pick_order_header
WHERE warehouse = 'XDGM'
AND order_status <> 'Complete'
AND order_status <> 'Closed'
AND pick_order_type <> 'Backorder'
AND customer_order_number LIKE '%1 hr%'";
?>
<!DOCTYPE HTML>
<link rel="stylesheet" type="text/css" href="css/master.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="js/jquery-barcode.js"></script>
<script>
setTimeout(function(){
window.location.reload(1);
}, 5000);
</script>
<html>
<title>Current Orders</title>
<body>
<table>
<?php
// SQLSRV Query
$results = sqlsrv_query($conn, $sql);
if($results === false) {
die(print_r(sqlsrv_errors(), true));
}
echo "
<table border=1>
<tr>
<th>Order Number</th>
<th>Order Status</th>
<th>Order Type</th>
<th>Customer Order</th>
<th>Barcode</th>
</tr>";
while ($row = sqlsrv_fetch_array($results))
{
$odrnum = $row[1];
$odrstatus = $row[2];
$odrtype = $row[3];
$custorder = $row[4];
$barcode = $row[1];
echo "
<tr>
<td>$odrnum</td>
<td>$odrstatus</td>
<td>$odrtype</td>
<td>$custorder</td>
<td>
<div id="bcTarget_'.$odrnum.'"><input type="button" id="bc" name="bc" value="Click Here" /></div>
</td>
<script>
$("#bc").click(function(){$("#bcTarget_'.$odrnum.'").barcode("'.$row[1].'", "code39",{barWidth:2.5, barHeight:30, showHRI: true, bgColor: "#DEF3CA"});});</script>
</tr>';
}
echo "</table>";
?>
</table>
</body>
</html>
我是一個完整的noob在這個,所以如果你找到一個解決方案,你可以解釋給我,所以我可以學習?
多謝
我得到一個語法錯誤,只是想找出錯誤在哪裏。 – eternityhq
@eternityhq我的壞** x2 **大聲笑,檢查更新代碼 –
這工作!你是我今天的英雄。 :)我會upvote你,如果我可以! – eternityhq