smujesse Posted July 12, 2007 Share Posted July 12, 2007 I am trying to come up with a script that pulls info out of a database and displays it in a grid-like layout using div's. I have it working in IE just fine, but in Safari/Firefox it only lists the items down the left side of the page (100% width div's) as if the PHP is ignoring the CSS. Here is the code: PHP: <?php $k=0; $getinfo = mysql_query("SELECT * from table"); while($info = mysql_fetch_array($getinfo)) { echo ("<div class='infoclass'><a href='page.php?id=$info[id]'>$info[item]</a></div>"); $k++; } ?> CSS: .infoclass { width:64px; height:64px; float:left; clear:none; margin:1px; padding:2px; border:solid 1px #E10505; } I am in dire need of a solution/fix or any better method of getting this same effect. Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 12, 2007 Share Posted July 12, 2007 CSS has nothing to do with your php code since your CSS style works client side not serverside your browser never gets to see a single line of php code. Somehow your generated HTML goes wrong. Try to view the source of your browser to see what goes wrong. Your php code looks fine to me I think its the div that contains all the floating divs Quote Link to comment Share on other sites More sharing options...
smujesse Posted July 12, 2007 Author Share Posted July 12, 2007 Thanks Dj, I guess what I meant by PHP was the HTML syntax used within PHP for echo. Like you can't use echo("<div class="class"></div>"); Is there a better way to display 64x64 boxes in a 8x8 grid? The floating div way worked for me in IE at one time but not in Safari/Firefox, which was different for me, usually the other way around! (I know that this post is double posted, I cant figure out how to delete one!) Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 12, 2007 Share Posted July 12, 2007 using single quote or double quote doesn't really matter for CSS but if you want to know how to use double quote with php here is how to echo("<div class=\"class\"></div>"); simply put slash infront of the double quote. can you post your HTML source as shown in your browser I am 100% your goal can be reached with your approach it's prob just a CSS thing Quote Link to comment Share on other sites More sharing options...
smujesse Posted July 12, 2007 Author Share Posted July 12, 2007 <div class='infoclass'><a href='page.php?id=34'>item</a></div> I think I need to just spend more time making sure the CSS files are linked correctly? I wish there was a web-based HTML editor that you could enter in your FTP info so that I could mess with this at work! After this I was planning to figure out a way that the order that the items are displayed can be changed by a drag and drop AJAX interface similar to how you edit your "top 8" in MySpace if that helps you understand what I am trying to get at. So I am not sure if the floating div is the best way to go about this. Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 12, 2007 Share Posted July 12, 2007 if your planning on a drag and drop functionality divs are definitely the way to go and tables will get you nowhere Quote Link to comment Share on other sites More sharing options...
smujesse Posted July 12, 2007 Author Share Posted July 12, 2007 Yeah, I thought so too. I need to figure out how to just display the divs correctly before I get into that I guess. Quote Link to comment 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.