sayedsohail Posted August 7, 2007 Share Posted August 7, 2007 Hi everyone, I am trying to print two html tables side by side, one table will have 2-4 columns and values from mysql_query, and the second table will just display few small icons. The reaon i am trying this, so i can link two separate tr onlick events. table 1 table 2 --------------|------------ echo'$name'; | <INPUT type='button' value='edit'> . . . . --------------|------------ here is my code which works perfectly fine to display records horizontally, but i want to display as above. $result = mysql_query($sql); $display = 2; $cols = 0; echo "<table>"; while($fetched = mysql_fetch_array($result)){ if($cols == 0){ echo "<tr>\n"; } // put what you would like to display within each cell here, if you noticed at the moment i am able to display button side by side for the record, but i want to display this in the iind table side by side. echo "<td>".$fetched['id']."<br />".$fetched['name']."</td><td><input type='button' value='Delete'></td><td>Insert</td><td>Print</td>\n"; $cols++; if($cols == $display){ echo "</tr>\n"; $cols = 0; } } // added the following so it would display the correct html if($cols != $display && $cols != 0){ $neededtds = $display - $cols; for($i=0;$i<$neededtds;$i++){ echo "<td></td>\n"; } echo "</tr></table>"; } else { echo "</table>"; } Any suggestions is greatly apprecaited. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/63717-php-echo-two-html-tables-side-by-side/ Share on other sites More sharing options...
ss32 Posted August 7, 2007 Share Posted August 7, 2007 use the colgroup tag; it has the onClick event that you are looking for. it will make things SO much easier than echoing two tables Quote Link to comment https://forums.phpfreaks.com/topic/63717-php-echo-two-html-tables-side-by-side/#findComment-317513 Share on other sites More sharing options...
sayedsohail Posted August 7, 2007 Author Share Posted August 7, 2007 This is what i am trying to achieve, but onlick and onmouseover non of the functions are working? print "<tr ><COLGROUP name=\"high\" onmouseover=\"flyOver(this)\" onmouseout=\"flyOut(this)\" onclick=\"selectMe(this);\">"; print "<td> $Service_Summary</td><td>$name</td></COLGROUP>"; print "<td>Delete</td><td>Insert</td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/63717-php-echo-two-html-tables-side-by-side/#findComment-317525 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.