mysql - how to get the passed value data from the database and show in a html table using php -


i have database , have table named supplier.it contains different columns region,country,9xx,10xx.

i fetching 9xx,10xx columns in drop down.when user select of them,selected value go to page mysql query performed , result shown in html table.

the problem not geting records database passed values(i.e supplierid : 10xx or 9xx) ,please see code

    <?php      $dbhost = 'localhost'; // localhost     $dbusername = 'xxxxxxxxx';     $dbpassword = 'xxxxxxxxxx';     $dbdatabase = 'xxxxxxxxxxx';     $db = mysql_connect($dbhost, $dbusername, $dbpassword) or die ("unable connect database server.");     mysql_select_db ($dbdatabase, $db) or die("could not select database.");      $supplierid = $_get['supplier_id'];     //supplierid 10xx or 9xx      $sql = "select region,country,$supplierid supplierprice order country asc ";      $sql_select = mysql_query($sql);       while($rows=mysql_fetch_array($sql_select))     {       if($alt == 1)             {                echo '<tr class="alt">';                $alt = 0;             }             else             {                echo '<tr>';                $alt = 1;             }      echo '                    <td id="cph_gridview1_billingmonth " style="width:40px" class="edit billingmonth '.$rows["id"].'">'.$rows["region"].'</td>                    <td id="cph_gridview1_country " style="width:101px" class="edit country '.$rows["id"].'">'.$rows["country"].'</td>                    <td id="cph_gridview1_mnc " style="width:51px" class="edit mnc '.$rows["id"].'">'.$rows[$supplierid].'</td>                   </tr>';      }       ?> 

you mixing html , php. can used not each other, should use following code :

just remove following code :

echo '    >                 <td id="cph_gridview1_billingmonth " style="width:40px" class="edit billingmonth > '.$rows["id"].'">'.$rows["region"].'</td>    >                 <td id="cph_gridview1_country " style="width:101px" class="edit country '.$rows["id"].'">'.$rows["country"].'</td>   >  >                 <td id="cph_gridview1_mnc " style="width:51px" class="edit mnc '.$rows["id"].'">'.$rows[$supplierid].'</td>  >  >  >           </tr>'; >  >     } >  >      ?> 

and add following code @ place

<td id="cph_gridview1_billingmonth " style="width:40px" class="edit billingmonth '<?php.$rows["id"] ?>.'"> <?     php echo $row["region"]; ?> </td>                                                  <td id="cph_gridview1_billingmonth " style="width:40px" class="edit billingmonth '<?php.$rows["id"] ?>.'"> <? php echo $row["country"]; ?> </td>      <td id="cph_gridview1_billingmonth " style="width:40px" class="edit billingmonth '<?php.$rows["id"] ?>.'"> <?php echo $row["id"]; ?> </td>      <?php          }           ?> 

hope helps.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -