 |
|
ครั้งนี้ ลอง วนลูปเอามาจากตารางครับ แต่ พอ แสดงผลก็ออกครับ ออกแถวสุดท้ายอ่ะครับ ไม่ออกหมด
Code (PHP)
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="91"> <div align="center">Mail</div></th>
<th width="91"> <div align="center">QR CODE</div></th>
</tr>
<?php
while($beer=sqlsrv_fetch_array($query))
{
?>
<tr>
<td><div align="center"><?php echo $beer["DOCNO"];?></div></td>
<td><div align="center"><?php echo $beer["ORIGMAIL"];?></div></td>
<td>
<?php
//ofcourse we need rights to create temp dir
if (!file_exists($PNG_TEMP_DIR))
mkdir($PNG_TEMP_DIR);
$filename = $PNG_TEMP_DIR.'test.png';
//processing form input
//remember to sanitize user input in real-life solution !!!
$errorCorrectionLevel = 'H';
if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
$errorCorrectionLevel = $_REQUEST['level'];
$matrixPointSize = 4;
if (isset($_REQUEST['size']))
$matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
if (isset($_REQUEST['data'])) {
//it's very important!
if (trim($_REQUEST['data']) == '')
die('data cannot be empty! <a href="?">back</a>');
// user data
$filename = $PNG_TEMP_DIR.''.md5($_REQUEST['$b'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
QRcode::png($_REQUEST['$b'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);
}
else
{
//default data
/*echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>'; */
QRcode::png ($beer["DOCNO"],$filename, $errorCorrectionLevel,4);
/* QRcode::png('$test');*/
}
//display generated file
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
?></td>
</tr>
<?php
}
?>
Tag : PHP, Ms SQL Server 2005
|
|
 |
 |
 |
 |
Date :
2017-08-18 17:06:54 |
By :
pissanu8970 |
View :
773 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |