Re: [PHP]REPOST: DB logic help...
> $conn = db_connect("fplg"); ... or die("Could not connect"); > > $bandquery = "SELECT linkid,title FROM links WHERE cat='band'"; > $sitequery = "SELECT linkid,title FROM links WHERE cat='site'"; > $miscquery = "SELECT linkid,title FROM links WHERE cat='misc'"; > > $bandresult = mysql_query($bandquery,$conn); ... or die(mysql_error()); > $siteresult = mysql_query($sitequery,$conn); ... or die(mysql_error()); > $miscresult = mysql_query($miscquery,$conn); ... or die(mysql_error()); > > header_start("FPLG:Links"); > ?> > > > > >Bands > > >Sites > > >Other > > > > > while($band_data = mysql_fetch_array($bandresult)); > { > ?> >" > class="hov1" target="_new"> color="WHITE"> > > } > ?> > > > while($site_data = mysql_fetch_array($siteresult)); > { > ?> >" > class="hov1" target="_new"> color="WHITE"> > > } > ?> > > > while($misc_data = mysql_fetch_array($miscresult)); > { > ?> >" > class="hov1" target="_new"> color="WHITE"> > > } > ?> > > > > > > > > this is supposed to display link information from my db in three columns, > one for bands, one for sites, and one for misc. only problem is that it's > not displaying correctly, as you can see: www.fplg.net/links.php > > any ideas on what the problem is? > > chris > > - Original Message - > From: Jon Haworth <[EMAIL PROTECTED]> > To: 'Chris Cocuzzo' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, July 31, 2001 11:57 AM > Subject: RE: [PHP]REPOST: DB logic help... > > > > What about something like: > > > > > > > $sql_bands = "SELECT Link FROM Table WHERE Category='band'"; > > $sql_sites = "SELECT Link FROM Table WHERE Category='site'"; > > $sql_other = "SELECT Link FROM Table WHERE Category='other'"; > > > > $query_bands = mysql_query($sql_bands); > > $query_sites = mysql_query($sql_sites); > > $query_other = mysql_query($sql_other); > > > > echo ""; > > echo "BandsSitesOther"; > > > > do { > > $data = false; > > echo ""; > > if ($row_bands = mysql_fetch_array($query_bands)) { > > echo "". $row_bands["Link"]. ""; > > $data = true; > > } else { > > echo " "; > > } > > if ($row_sites = mysql_fetch_array($query_sites)) { > > echo "". $row_sites["Link"]. ""; > > $data = true; > > } else { > > echo " "; > > } > > if ($row_other = mysql_fetch_array($query_other)) { > > echo "". $row_other["Link"]. ""; > > $data = true; > > } else { > > echo " "; > > } > > echo ""; > > } while ($data == true); > > > > echo ""; > > > > ?> > > > > It's untested, and fairly inelegant in that you get an empty row at the > > bottom, so you could count the rows for each set beforehand as part of the > > SQL instead of using $data as I have - but it may be a good starting > point. > > > > HTH > > Jon > > > > > > -Original Message- > > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] > > Sent: 31 July 2001 16:36 > > To: [EMAIL PROTECTED] > > Subject: [PHP]REPOST: DB logic help... > > > > > > hey- > > > > I have a few pages on my website which need to be divided up into > different > > columns and rows based on a category in a table. for example, on a links > > page, I have three different columns, one for bands, one for sites, and > one > > for other things. I'm storing those things in the table with a category > > field, so that when I output the data, it goes to the right place. However > > I'm a little unsure of the actual code to do this... > > > > can someone lend me an example or give me some ideas? > > > > thanks > > chris > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP]REPOST: DB logic help...
hey- ok, so I've worked on my problem a bit, and here's what I came up, and note this is the whole page. Bands Sites Other " class="hov1" target="_new"> " class="hov1" target="_new"> " class="hov1" target="_new"> this is supposed to display link information from my db in three columns, one for bands, one for sites, and one for misc. only problem is that it's not displaying correctly, as you can see: www.fplg.net/links.php any ideas on what the problem is? chris - Original Message - From: Jon Haworth <[EMAIL PROTECTED]> To: 'Chris Cocuzzo' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 31, 2001 11:57 AM Subject: RE: [PHP]REPOST: DB logic help... > What about something like: > > > $sql_bands = "SELECT Link FROM Table WHERE Category='band'"; > $sql_sites = "SELECT Link FROM Table WHERE Category='site'"; > $sql_other = "SELECT Link FROM Table WHERE Category='other'"; > > $query_bands = mysql_query($sql_bands); > $query_sites = mysql_query($sql_sites); > $query_other = mysql_query($sql_other); > > echo ""; > echo "BandsSitesOther"; > > do { > $data = false; > echo ""; > if ($row_bands = mysql_fetch_array($query_bands)) { > echo "". $row_bands["Link"]. ""; > $data = true; > } else { > echo " "; > } > if ($row_sites = mysql_fetch_array($query_sites)) { > echo "". $row_sites["Link"]. ""; > $data = true; > } else { > echo " "; > } > if ($row_other = mysql_fetch_array($query_other)) { > echo "". $row_other["Link"]. ""; > $data = true; > } else { > echo " "; > } > echo ""; > } while ($data == true); > > echo ""; > > ?> > > It's untested, and fairly inelegant in that you get an empty row at the > bottom, so you could count the rows for each set beforehand as part of the > SQL instead of using $data as I have - but it may be a good starting point. > > HTH > Jon > > > -Original Message- > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] > Sent: 31 July 2001 16:36 > To: [EMAIL PROTECTED] > Subject: [PHP]REPOST: DB logic help... > > > hey- > > I have a few pages on my website which need to be divided up into different > columns and rows based on a category in a table. for example, on a links > page, I have three different columns, one for bands, one for sites, and one > for other things. I'm storing those things in the table with a category > field, so that when I output the data, it goes to the right place. However > I'm a little unsure of the actual code to do this... > > can someone lend me an example or give me some ideas? > > thanks > chris > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP]REPOST: DB logic help...
thanks jon. I think that's a step in the right direction. I've included a sample of the HTML of the links page so you can get a better idea as to how i want things to look. Your code below looks awesome, the only thing I was curious about though was that it would create a table with only one column when it's running through the loop. maybe I'm wrong, what are your thoughts?.. here's the html: http://www.soulive.com"; class="hov1" target="_blank">Soulive http://www.addisongroove.com"; class="hov1" target="_blank">Addison Groove Project http://www.deepbananablackout.com"; class="hov1" target="_blank">Deep Banana Blackout http://www.theslip.com"; class="hov1" target="_blank">The Slip http://www.miracleorchestra.com"; class="hov1" target="_blank">Miracle Orchestra http://www.ulu.net"; class="hov1" target="_blank">ulu http://www.jemstatic.com"; class="hov1" target="_blank">Jem Static http://members.aol.com/weezer1029/"; class="hov1" target="_blank">Premiere http://www.tgqonline.com"; class="hov1" target="_blank">Todd Gaynor Quartet http://www.mp3.com"; class="hov1" target="_blank">MP3.com http://www.soundclick.com"; class="hov1" target="_blank">Soundclick http://www.jambase.com"; class="hov1" target="_blank">Jambase http://www.jambands.com"; class="hov1" target="_blank">Jambands.com http://www.gigcity.com"; class="hov1" target="_blank">GigCity http://www.thesoundboard.com"; class="hov1" target="_blank">thesoundboard http://www.velourmusic.com"; class="hov1" target="_blank">Velour Music http://www.gamelan.tv"; class="hov1" target="_blank">Gamelan Productions http://www.supersonicrecording.com"; class="hov1" target="_blank">Supersonic Studios http://www.ccnow.com"; class="hov1" target="_blank">CCNow http://www.unionst.com"; class="hov1" target="_blank">The Attic I realize all that is very long, but I wanted you to see it all. that's how I need it to come out from the db. thanks a lot, and I'll be working on it myself. chris - Original Message - From: Jon Haworth <[EMAIL PROTECTED]> To: 'Chris Cocuzzo' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 31, 2001 11:57 AM Subject: RE: [PHP]REPOST: DB logic help... > What about something like: > > > $sql_bands = "SELECT Link FROM Table WHERE Category='band'"; > $sql_sites = "SELECT Link FROM Table WHERE Category='site'"; > $sql_other = "SELECT Link FROM Table WHERE Category='other'"; > > $query_bands = mysql_query($sql_bands); > $query_sites = mysql_query($sql_sites); > $query_other = mysql_query($sql_other); > > echo ""; > echo "BandsSitesOther"; > > do { > $data = false; > echo ""; > if ($row_bands = mysql_fetch_array($query_bands)) { > echo "". $row_bands["Link"]. ""; > $data = true; > } else { > echo " "; > } > if ($row_sites = mysql_fetch_array($query_sites)) { > echo "". $row_sites["Link"]. ""; > $data = true; > } else { > echo " "; > } > if ($row_other = mysql_fetch_array($query_other)) { > echo "". $row_other["Link"]. ""; > $data = true; > } else { > echo " "; > } > echo ""; > } while ($data == true); > > echo ""; > > ?> > > It's untested, and fairly inelegant in that you get an empty row at the > bottom, so you could count the rows for each set beforehand as part of the > SQL instead of using $data as I have - but it may be a good starting point. > > HTH > Jon > > > -Original Message- > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] > Sent: 31 July 2001 16:36 > To: [EMAIL PROTECTED] > Subject: [PHP]REPOST: DB logic help... > > > hey- > > I have a few pages on my website which need to be divided up into different > columns and rows based on a category in a table. for example, on a links > page, I have three different columns, one for bands, one for sites, and one > for other things. I'm storing those things in the table with a category > field, so that when I output the data, it goes to the right place. However > I'm a little unsure of the actual code to do this... > > can someone lend me an example or give me some ideas? > > thanks > chris > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP]REPOST: DB logic help...
What about something like: "; echo "BandsSitesOther"; do { $data = false; echo ""; if ($row_bands = mysql_fetch_array($query_bands)) { echo "". $row_bands["Link"]. ""; $data = true; } else { echo " "; } if ($row_sites = mysql_fetch_array($query_sites)) { echo "". $row_sites["Link"]. ""; $data = true; } else { echo " "; } if ($row_other = mysql_fetch_array($query_other)) { echo "". $row_other["Link"]. ""; $data = true; } else { echo " "; } echo ""; } while ($data == true); echo ""; ?> It's untested, and fairly inelegant in that you get an empty row at the bottom, so you could count the rows for each set beforehand as part of the SQL instead of using $data as I have - but it may be a good starting point. HTH Jon -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 16:36 To: [EMAIL PROTECTED] Subject: [PHP]REPOST: DB logic help... hey- I have a few pages on my website which need to be divided up into different columns and rows based on a category in a table. for example, on a links page, I have three different columns, one for bands, one for sites, and one for other things. I'm storing those things in the table with a category field, so that when I output the data, it goes to the right place. However I'm a little unsure of the actual code to do this... can someone lend me an example or give me some ideas? thanks chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]