Jump to content

Dynamically creating a table


vmicchia

Recommended Posts

What I want to do is create a table out of records from a table that shows an image and a radio button under the image (so I would imagine it would be in 2 rows). I want it to have 3 columns across. Here's what I have to get and output the results:

    $fabricsql = "SELECT * FROM Fabric f, Images i WHERE f.SKU = i.SKU";
        //echo $fabricsql;
        $fabricResult = mysql_query($fabricsql);
        $i=0;
        while($fabricAssoc = mysql_fetch_assoc($fabricResult)){
            //echo $fabricAssoc['SKU']. "+ ".$fabricAssoc['Name'];
            echo "<a href=\"\"><img src='../../".$fabricAssoc['ThumbPath']."' alt='".$fabricAssoc['Description']."' width='".$fabricAssoc['ThumbWidth']."' /></a><br />
             <input type=\"radio\" name=\"fabricSelect\" value='".$fabricAssoc['SKU']."' id=\"RadioGroup1_".$i."\" /><br /><br />";    
             $i++;
        }
        

 

Any help is much appreciated. I'm not even sure this is the best way to go about this so any suggestions are appreciated.

Link to comment
https://forums.phpfreaks.com/topic/217239-dynamically-creating-a-table/
Share on other sites

Yes Pikachu200 that is exactly what I would like to do. I am sorry I was not more clear. I also want to apologize for not responding sooner I was away for the weekend with no internet access. I will check out that articles businessman332211 thank you for posting them.

I would need to get more information. From what I can tell, what you want to look into are mapping tables.

 

Mapping Table References

 

http://www.wellho.net/solutions/mysql-many-to-many-table-mapping-pivot-tables.html

 

I see where my original post was ambiguous as to what I wanted. Those a very helpful articles and I appreciate the read. However, it's not hat I was looking for. I am wanting to make HTML tables that are 3 columns wde but I am not sure how to make the width in the given while statement or really any.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.