MrRay Posted June 14, 2006 Share Posted June 14, 2006 Well, most of the problems I had in the past have been overcome. Currently I have been trying to learn LAMP (linux, apache, mysql, php) based webdesign on my free time and I am going pretty slow in my progress. I am making an antique site for a friend/boss of mine and I have a question about how to do something.We have the site:+-------------------------------+|the site!.............................|+-------------------------------+|.menu ..............................|+-------------------------------+|+-----------------------------+|||content_window...............||||-----float left row-----------|||| +---+.+---+.+---+.+---+ |||| |pic |..|pic |...|pic |.| pic| |||| |txt |..| txt|...|txt |..|txt | |||| +---+.+---+.+---+.+---+ ||||------------------------------|||+-----------------------------+|+-------------------------------+so if i made it good enough to read, i have 4 boxes w/ pictures and descriptions of items in a row to prevent overflowing when i float them left, and I want my mysql database to have stuff like the item no and stuff like that that i already pretty much have a good idea of. The thing I am having a little bit of confusion with is the php. I want it to check if it there is any results, if there are---it will make a row for 4 boxes w/ descriptions and pics and then close the row make a new one and start over. I need some guidance cause I am a little new to this.If anyone could help I can not express how much I would appreciate it. I would try it on my own, but I want to see if any of you guys could give me a push in the right direction at least so I save a little time. I am using and CSS w/ XHTML strict rules for the setup. If I HAVE TO, I might cave and use tables..but I rather not... Any help would doTHXRay--------------------------------------------BTW: I graduated--wooot woot Link to comment https://forums.phpfreaks.com/topic/12010-row-builder-for-inventory/ Share on other sites More sharing options...
Barand Posted June 14, 2006 Share Posted June 14, 2006 Something like[code]<html><head><meta name="generator" content="PhpED Version 4.5 (Build 4513)"><title>Sample</title><meta name="author" content="Barand"><link rel="shortcut icon" href=""><STYLE type="text/css">div.pic { float: left; border: 1px solid silver; width: 150px; margin: 5px 0 0 5px; padding: 5px; text-align: center;}br { clear: both;}</STYLE></head><body><?phpmysql_connect('localhost', '*****', '*****');mysql_select_db('dbname');$sql = "SELECT imagefile, description FROM inventory ORDER BY area, locname";$res = mysql_query($sql) or die(mysql_error());$count = 0;while (list ($i, $d) = mysql_fetch_row($res)) { echo "<div class='pic'><img src='$i'><br/>$d</div>\n"; if (++$count % 4 == 0) { echo "<br/>\n"; }} echo "<br/>\n";?></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/12010-row-builder-for-inventory/#findComment-45735 Share on other sites More sharing options...
MrRay Posted June 15, 2006 Author Share Posted June 15, 2006 yea thats almost what I am looking for, it definitely has the concept. I was thinking of using a while loop, but I wasn't sure how to implement it. I'll reply again w/ the site code after I clean it up a bit more for the recent revision I've been doing--the one I have now is about 4 versions old so gimme a sec to do updates to it and then we can go from there, I really have to thank you for this I was lost w/ this at first. Link to comment https://forums.phpfreaks.com/topic/12010-row-builder-for-inventory/#findComment-46080 Share on other sites More sharing options...
MrRay Posted June 16, 2006 Author Share Posted June 16, 2006 [!--quoteo(post=384365:date=Jun 15 2006, 04:50 PM:name=theCrandallSter)--][div class=\'quotetop\']QUOTE(theCrandallSter @ Jun 15 2006, 04:50 PM) [snapback]384365[/snapback][/div][div class=\'quotemain\'][!--quotec--]yea thats almost what I am looking for, it definitely has the concept. I was thinking of using a while loop, but I wasn't sure how to implement it. I'll reply again w/ the site code after I clean it up a bit more for the recent revision I've been doing--the one I have now is about 4 versions old so gimme a sec to do updates to it and then we can go from there, I really have to thank you for this I was lost w/ this at first.[/quote] I changed a bit and added the extra parts in and got it to work, so I'm good, but I really have to thank you on this :). I am just a newbie, but at some point I wanna get as good as you. I think I'll take PHP when I go to college in the fall. Link to comment https://forums.phpfreaks.com/topic/12010-row-builder-for-inventory/#findComment-46314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.