Zergman Posted January 22, 2009 Share Posted January 22, 2009 I can't seem to figure out how to repeat my data horizontally instead of vertically. I tried searching google, but most of the results are for a dreamweaver extension to do it. Can't find out how to do it by hand. Here is my query. Pardon my newbish skills, still learning <?php mysql_select_db($database_cntrackanator, $cntrackanator); $query_rssql = "SELECT * FROM templates_categories WHERE uname = '$username' ORDER BY category_name"; $rssql = mysql_query($query_rssql, $cntrackanator) or die(mysql_error()); $row_rssql = mysql_fetch_assoc($rssql); $totalRows_rssql = mysql_num_rows($rssql); echo $row_rssql['category_name']; ?> So how can I get this to loop vertically instead of down? Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/ Share on other sites More sharing options...
sasa Posted January 22, 2009 Share Posted January 22, 2009 while($row_rssql = mysql_fetch_assoc($rssql)) echo '<div class="cat_name">',$row_rssql['category_name'],"</div>\n"; and add CSS to format it Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/#findComment-743442 Share on other sites More sharing options...
Zergman Posted January 22, 2009 Author Share Posted January 22, 2009 Thats pretty cool sasa, im just not that good with css formatting quite yet. Can you point me in the right direction of what im looking for regarding the css formatting for this? Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/#findComment-743461 Share on other sites More sharing options...
sasa Posted January 22, 2009 Share Posted January 22, 2009 <style> .cat_name { display: inline; margin: 0 2 0 0; border: 2 solid red; padding: 2 6 3 6; color: white; background-color: blue; } </style> Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/#findComment-743532 Share on other sites More sharing options...
Zergman Posted January 22, 2009 Author Share Posted January 22, 2009 k, that is pretty wicked, im really going to have to read up on this more. One last thing that will solve this issue. I want to make the output link to the same variable name as whats shown. This is what I have so far but not doing something right here. <?php mysql_select_db($database_cntrackanator, $cntrackanator); $query_rssql = "SELECT * FROM templates_categories WHERE uname = '$username' ORDER BY category_name"; $rssql = mysql_query($query_rssql, $cntrackanator) or die(mysql_error()); $row_rssql = mysql_fetch_assoc($rssql); $totalRows_rssql = mysql_num_rows($rssql); while($row_rssql = mysql_fetch_assoc($rssql)) echo '<div class="cat_name">[<a href="">',$row_rssql['category_name'],"</a>]</div>\n "; ?> I want to use the same $row_rssql['category_name'] in the hyperlink but can't get the proper syntax right. Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/#findComment-743596 Share on other sites More sharing options...
sasa Posted January 22, 2009 Share Posted January 22, 2009 echo '<div class="cat_name">[<a href="',$row_rssql['category_name'],'">',$row_rssql['category_name'],"</a>]</div>\n "; Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/#findComment-743607 Share on other sites More sharing options...
Zergman Posted January 22, 2009 Author Share Posted January 22, 2009 sasa, thank you very much for your help. Its really cool learning new things like this Quote Link to comment https://forums.phpfreaks.com/topic/141986-solved-horizontal-repeat-regions/#findComment-743629 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.