|
|
|
อยากให้ส่วนที่อยู่ในกรอบในโค้ดบรรทัด 56 แสดงข้อมูลโดยดึงจาก database เหมือนแบบที่อยู่ในกรอบในโค้ดบรรทัด 90 ทำอย่างไรครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
echo "<h1>PHP QR Code</h1><hr/>";
//set it to writable location, a place for temp generated PNG files
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
//html PNG location prefix
$PNG_WEB_DIR = 'temp/';
include "qrlib.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 = 'L';
if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
$errorCorrectionLevel = $_REQUEST['level'];
$matrixPointSize = 3;
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.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
QRcode::png($_REQUEST['data'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);
} else {
//default data
QRcode::png('TEST',$filename, $errorCorrectionLevel, $matrixPointSize, 2);
}
//display generated file
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
//config form
//_________________________________________________________________________________________________________________
echo '<form action="index.php" method="post">
Data1: <input name="data" value="'.(isset($_REQUEST['data'])?htmlspecialchars($_REQUEST['data']):'').'" /> ';
//_________________________________________________________________________________________________________________
echo ' <input type="submit" value="GENERATE"></form><hr/>';
// benchmark
//QRtools::timeBenchmark();
?>
<table class="table-responsive" width="25%" border="0" align="center">
<thead>
<?php
include "..//template/dream/testconnectDB.php";
$i = "select * from people";
$h = mysql_query($i);
while($tr=mysql_fetch_array($h))
{
?>
<tr>
<th>ชื่อ</th>
<!--________________________________________________________________________________________________________-->
<input type="text" value="<?php echo $tr[1]; ?>">
<td><?php echo $tr[1]; ?></td>
<!--________________________________________________________________________________________________________-->
</tr>
<tr>
<th>นามสกุล</th>
<td><?php echo $tr[2]; ?></td>
</tr>
<tr>
<th>อายุ (ปี)</th>
<td><?php echo $tr[3]; ?></td>
</tr>
<tr>
<th>น้ำหนัก (กิโลกรัม)</th>
<td><?php echo $tr[4]; ?></td>
</tr>
<tr>
<th>อาการแพ้ยา</th>
<td><?php echo $tr[5]; ?></td>
</tr>
</thead>
<?php
}
?>
</table>
//////
Tag : PHP, HTML/CSS
|
ประวัติการแก้ไข 2016-04-06 21:57:59 2016-04-06 21:58:54 2016-04-06 21:59:59 2016-04-06 22:00:36 2016-04-06 22:02:28
|
|
|
|
|
Date :
2016-04-06 21:56:31 |
By :
dedee |
View :
794 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ปิด เปิด tag php ดูครับ
Code (PHP)
<?php
echo "php coding<br />";
?>
htnl code <br />
<?php
echo "end php & html code";
?>
|
|
|
|
|
Date :
2016-04-06 23:00:15 |
By :
mangkunzo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2016-04-08 09:13:40 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|