简体   繁体   中英

in php array fetch all rows from mysql database into the single table td?

in php array fetch all rows from mysql database and all values are showing into the single table td? i Want results like this?

1) Small
2) Large
3) Medium

now problem is that all values displaying into single table td i want to display all of these values into separately table td

Query Function

function get_size($id){
$result=mysql_query("SELECT size FROM mywishlist order by id") 
or die("My Wish Size Problem"."<br/><br/>".mysql_error());
$results = array();
while($row=mysql_fetch_array($result)){
$results[] = stripslashes($row['size'])."<br />";
}
return $results;
}

<td><font style="font-family:Arial,Helvetica,sans-serif;  
font-size:15px; color:#000;">
<?php 
foreach($size as $sizes) {
echo $sizes; }
?></font><input type="hidden" name="size" value="<?php echo $size;?>" /></td>  
<?php foreach ($size as $sizes) { ?>
    <td><font style="font-family:Arial,Helvetica,sans-serif;font-size:15px; color:#000;">
        <?php echo $sizes; ?> 
        </font><input type="hidden" name="size" value="<?php echo $size; ?>" /></td>  
<?php } ?>
<?php foreach ($sizes as $size) { ?>
   <td>
     <font style="font-family:Arial,Helvetica,sans-serif;font-size:15px; color:#000;">
       <input type="hidden" name="size" value="<?php echo $size; ?>" />
     </font>
   </td>  
<?php } ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM