spider22 Posted November 17, 2007 Share Posted November 17, 2007 Here the is my code ... I want to add hyper link in my title field How I can do that? and is it possible to display data in the 2 columns instead of one ... // Get all the data from the "example" table $result = mysql_query("SELECT * FROM `jos_content` WHERE catid = '22' ORDER BY title ASC") or die(mysql_error()); echo "<table border='1' style='border-spacing:1px;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;background-color:#E7E7E7;color:black;'><tr><th>Drama Review</th><th>Hits</th></tr>"; // keeps getting the next row until there are no more to get $last_letter = null; while($row = mysql_fetch_array( $result )) { $current_letter = strtolower($row['title'][0]); if($current_letter != $last_letter){//this means the first letter changed echo "<tr><td colspan='2' style='background-color:black;color:white;'><center><b>$current_letter</b></center></td></tr>"; } // Print out the contents of each row into a table echo "<tr><td>"; echo $row['title']; echo "</td><td>"; echo $row['hits']; echo "</td></tr>"; $last_letter = $current_letter;//always change this so it's based on the previous } echo "</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/ Share on other sites More sharing options...
phpQuestioner Posted November 17, 2007 Share Posted November 17, 2007 <?php // Get all the data from the "example" table $result = mysql_query("SELECT * FROM `jos_content` WHERE catid = '22' ORDER BY title ASC") or die(mysql_error()); echo "<table border='1' style='border-spacing:1px;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;background-color:#E7E7E7;color:black;'><tr><th>Drama Review</th><th>Hits</th></tr>"; // keeps getting the next row until there are no more to get $last_letter = null; while($row = mysql_fetch_array( $result )) { $current_letter = strtolower($row['title'][0]); if($current_letter != $last_letter){//this means the first letter changed echo "<tr><td colspan='2' style='background-color:black;color:white;'><center>$current_letter</center></td></tr>"; } // Print out the contents of each row into a table echo "<tr><td>"; echo "<a href='page.html'>"; echo $row['title']; echo "</a>"; echo "</td><td>"; echo $row['hits']; echo "</td></tr>"; $last_letter = $current_letter;//always change this so it's based on the previous } echo "</table>"; ?> what exactly do you mean: is it possible to display data in the 2 columns instead of one ... are you talking about your html table? Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/#findComment-393318 Share on other sites More sharing options...
spider22 Posted November 17, 2007 Author Share Posted November 17, 2007 at the moment its displaying like this http://muziqcafe.com/yes/test6.php I want to display like this http://www.indiafm.com/movies/musicreviewslist.html thanks Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/#findComment-393320 Share on other sites More sharing options...
phpQuestioner Posted November 17, 2007 Share Posted November 17, 2007 their just nesting tables to accomplish their layout, but you can do the same thing with your layout; you just need to format the html and/or css as you would like it to display. you could start by setting the width of your table and td tags. Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/#findComment-393322 Share on other sites More sharing options...
nuxy Posted November 17, 2007 Share Posted November 17, 2007 Someone had a similar problem before. I suggest you use the search feature next time. http://www.phpfreaks.com/forums/index.php/topic,167315.msg737354.html Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/#findComment-393324 Share on other sites More sharing options...
spider22 Posted November 17, 2007 Author Share Posted November 17, 2007 their just nesting tables to accomplish their layout, but you can do the same thing with your layout; you just need to format the html and/or css as you would like it to display. you could start by setting the width of your table and td tags. Can you give sample code? thanks Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/#findComment-393325 Share on other sites More sharing options...
phpQuestioner Posted November 17, 2007 Share Posted November 17, 2007 this is a example of a nested table: <table width=500> <td> <table width=100%> <td width=50%> Left Side </td> <td width=50%> Right Side </td> </table> </td> </table> Link to comment https://forums.phpfreaks.com/topic/77696-solved-hyperlink-and-columns/#findComment-393328 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.