Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001062

Re: [PHP] ->>coding help From: Richard Lynch (ceo <email protected>)
Date: 06/25/01

Oh yeah: I forgot:

*AFTER* the loop, you need to add another spurious </TR>.

You'll have an empty row with no TD's in it, and the browser won't even put
in a blank line or anything.

Just spew out an extra </TR> at the end and call it done.

--
WARNING richard <email protected> address is an endangered species -- Use
ceo <email protected>
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "McShen" <webmaster <email protected>>
Newsgroups: php.general
Sent: Saturday, June 23, 2001 10:13 PM
Subject: [PHP] ->>coding help

> Hi > > I have a script which queries mySQL and outputs 32 links at once. Here is my > scipt > ---- > <?php > > $connection = mysql_connect("***","****","****"); > if ($connection==false) > { > echo mysql_errno().":".mysql_error().""; > exit; > } > > $end = $list + 16; > > $query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list, $end"; > $result = mysql_db_query ("celebzone", $query); > > $num = mysql_num_rows($result); > > $j=0; > $i=0; > echo "<table border=0>\n"; > echo "<tr>\n"; > while ($j!=$num) > { > @$r = mysql_fetch_array($result); > @$id = $r[id]; > @$title = $r[title]; > > echo "<td>\n"; > echo "$title"; > echo "</td>\n"; > // new row in table every other link > $i++; > if (($i % 2) < 1) > { > echo "</tr>\n<tr>\n"; > } > > $j++; > } > echo "</table>"; > > echo "<br><br>\n"; > > > ?> > ----------------------- > And here is the link to see it in action > http://www.celebritieszones.com/ln.php?list=0 > > If you check my HTML source, at the end, right before </table>, you will see > an extra <tr>. I know the cause of this. It's because of this > ------- > " > $i++; > if (($i % 2) < 1) > { > echo "</tr>\n<tr>\n"; > } > " > ----- > > I don't know how to fix the problem. Please help me re-write the script a > bit so that it doesn't add the extra <tr>. > > Thanks in advance. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe <email protected> > For additional commands, e-mail: php-general-help <email protected> > To contact the list administrators, e-mail: php-list-admin <email protected> >

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>