从PHP MySQL查询中的变量获取表名

时间:2019-03-15 05:19:20

标签: php mysql

      $(document).ready(function(){
  $("#category").change(function(){
   var selectcat = $('#category').val(); 
  if(selectcat=="distribution"){
   <?php $page_select="is_distribution"; ?>
 }
 if(selectcat=="disc_man"){
  <?php $page_select="is_discmanufacturing"; ?>
 }
if(selectcat=="p_man"){
 <?php $page_select="is_pmanufacturing"; ?>
}
  if(selectcat=="erp_services"){
  <?php $page_select="is_erpservices"; ?>
 }
    if(selectcat=="crm_services"){
    <?php $page_select="is_crmservice"; ?>
 }
 if(selectcat=="others"){
 <?php $page_select="is_others"; ?>
 }
 });
  });

$table  = mysqli_query($conn ,'SELECT * FROM $page_select');
while($row  = mysqli_fetch_array($table)){ 

 <option value="<?php echo $row['item']; ?>"><?php echo $page_select; ?><? 
 php echo $row['item']; ?></option>

查询显示0结果。我想从值访问表名。我将如何 在mysqli查询中打印$ page_select? 我从javascript中获取价值

0 个答案:

没有答案