Re: REPOST: DB logic help...
| From: | Chris Cocuzzo | Date: | Wed, 01 Aug 2001 04:14:19 +0000 |
| Subject: | Re: REPOST: DB logic help... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60568@lists.php.net to get a copy of this message | ||
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:
<tr>
<td width="160" valign="top" bgcolor="#08296b">
<font face="verdana" size="1">
<a href="http://www.soulive.com"
class="hov1"
target="_blank">Soulive</a>
<br><br>
<a href="http://www.addisongroove.com"
class="hov1"
target="_blank">Addison Groove Project</a>
<br><br>
<a href="http://www.deepbananablackout.com"
class="hov1"
target="_blank">Deep Banana Blackout</a>
<br><br>
<a href="http://www.theslip.com"
class="hov1" target="_blank">The
Slip</a>
<br><br>
<a href="http://www.miracleorchestra.com"
class="hov1"
target="_blank">Miracle Orchestra</a>
<br><Br>
<a href="http://www.ulu.net"
class="hov1" target="_blank">ulu</a>
<br><br>
<a href="http://www.jemstatic.com"
class="hov1" target="_blank">Jem
Static</a>
<br><br>
<a href="http://members.aol.com/weezer1029/"
class="hov1"
target="_blank">Premiere</a>
<br><br>
<a href="http://www.tgqonline.com"
class="hov1" target="_blank">Todd
Gaynor Quartet</a>
</font>
</td>
<td width="160" valign="top" bgcolor="#08296b">
<font face="verdana" size="1">
<a href="http://www.mp3.com"
class="hov1" target="_blank">MP3.com</a>
<br><br>
<a href="http://www.soundclick.com"
class="hov1"
target="_blank">Soundclick</a>
<br><br>
<a href="http://www.jambase.com"
class="hov1"
target="_blank">Jambase</a>
<br><br>
<a href="http://www.jambands.com"
class="hov1"
target="_blank">Jambands.com</a>
<br><br>
<a href="http://www.gigcity.com"
class="hov1"
target="_blank">GigCity</a>
<br><br>
<a href="http://www.thesoundboard.com"
class="hov1"
target="_blank">thesoundboard</a>
</font>
</td>
<td width="160" valign="top" bgcolor="#08296b">
<font face="verdana" size="1">
<a href="http://www.velourmusic.com"
class="hov1" target="_blank">Velour
Music</a>
<br><br>
<a href="http://www.gamelan.tv"
class="hov1" target="_blank">Gamelan
Productions</a>
<br><br>
<a href="http://www.supersonicrecording.com"
class="hov1"
target="_blank">Supersonic Studios</a>
<br><br>
<a href="http://www.ccnow.com"
class="hov1" target="_blank">CCNow</a>
<br><br>
<a href="http://www.unionst.com"
class="hov1" target="_blank">The
Attic</a>
</font>
</td>
</tr>
</table>
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 <jhaworth@witanjardine.co.uk>
To: 'Chris Cocuzzo' <cuzo@mediaone.net>; <php-general@lists.php.net>
Sent: Tuesday, July 31, 2001 11:57 AM
Subject: RE: [PHP]REPOST: DB logic help...
> What about something like:
>
> <?php
>
> $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 "<table>";
> echo
> "<tr><td>Bands</td><td>Sites</td><td>Other</td></tr>";
>
> do {
> $data = false;
> echo "<tr>";
> if ($row_bands = mysql_fetch_array($query_bands)) {
> echo "<td>". $row_bands["Link"]. "</td>";
> $data = true;
> } else {
> echo "<td> </td>";
> }
> if ($row_sites = mysql_fetch_array($query_sites)) {
> echo "<td>". $row_sites["Link"]. "</td>";
> $data = true;
> } else {
> echo "<td> </td>";
> }
> if ($row_other = mysql_fetch_array($query_other)) {
> echo "<td>". $row_other["Link"]. "</td>";
> $data = true;
> } else {
> echo "<td> </td>";
> }
> echo "</tr>";
> } while ($data == true);
>
> echo "</table>";
>
> ?>
>
> 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:cuzo@mediaone.net]
> Sent: 31 July 2001 16:36
> To: php-general@lists.php.net
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net