jermaindefoe Posted November 10, 2009 Share Posted November 10, 2009 I have a page that currently is populating some information from a database and turning it in to links to another page for this i am using a while loop with mysql_fetch_array and generating the links in this. However the output then is with the links really tightly packed one after the other, so i thought i would use some css to try and make it look better How can i add css in to this as its in the php code isnt it? thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/181022-css-and-php/ Share on other sites More sharing options...
bossman Posted November 10, 2009 Share Posted November 10, 2009 post your code that is generating the links Quote Link to comment https://forums.phpfreaks.com/topic/181022-css-and-php/#findComment-955063 Share on other sites More sharing options...
jermaindefoe Posted November 10, 2009 Author Share Posted November 10, 2009 post your code that is generating the links $value = mysql_query("select * from field"); while($val= mysql_fetch_array($values)){ echo "<a href=newpg.php?id=".$val['key']."'>".$val[itsType]."</a>" . "<br/>"; } Quote Link to comment https://forums.phpfreaks.com/topic/181022-css-and-php/#findComment-955067 Share on other sites More sharing options...
KevinM1 Posted November 10, 2009 Share Posted November 10, 2009 Even though the code that's generating the links is written in PHP, its outputting HTML. Simply use what you would for straight HTML with CSS - an id or class that a stylesheet can grab a hold of, or an inline style. Example: while($val = mysql_fetch_assoc($values)) { echo "<a href='newpg.php?id=" . $val['key'] . "' class='links'>" . $val['itsType'] . "</a><br />"; } Quote Link to comment https://forums.phpfreaks.com/topic/181022-css-and-php/#findComment-955084 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.