我是PHP初學者我正在嘗試生成PDF,但我無法顯示選定複選框中的數據。例如,我想選擇兩行或三或四使用此select * from table where id in ($stk)
,但其顯示空白。顯示來自選定複選框的數據
<input type='checkbox' name='stick[]' id="stick" value =' <?php echo $row['id']; ?>' />
$name = isset($_POST['stick'])?$_POST['stick']:NULL;
if(isset($_POST['stick'])){
foreach ($name as $stk){
$query = "SELECT * FROM machine_and_equipments where MENo in($stk)";
$result = mysql_query($query) or die (mysql_error());
while($query_row = mysql_fetch_assoc($result)){
$controlnumber = $query_row['MENo'];
$assetname = $query_row['machine_equipments_name'];
$location = $query_row['Location'];
$text = sprintf("%s\n%s\n%s\n%s\n%s", "Koushin Mechatronics Manufacturing Philippines Inc. ", ' PROPERTY STICKER', 'Control No. : '. $controlnumber .' ', 'Asset Name : '. $assetname .' ', 'Location : '. $location .' ');}
'** SELECT'你爲什麼要把'**'放在這裏? – 2014-09-04 06:11:04
忽略'**'?在你的查詢 – 2014-09-04 06:20:20
沒關係**我已經刪除看這個例子這個「選擇*從machine_and_equipments其中MENO在(1,2,3)」是正確的,但是當我把變量「SELECT * FROM machine_and_equipments其中MENO在($ stk)「它嚇壞了我怎麼能用逗號1,2,3在$ stk – KENN 2014-09-04 06:34:24