Re: Table results returning 2 sets of the same row

From: Date: Sat, 18 Aug 2001 22:40:04 +0000
Subject: Re: Table results returning 2 sets of the same row
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-11508@lists.php.net to get a copy of this message
OK, I got it... I used $date = $row["date"]; $news = $row["news"]; to define the rows. Thats great. I am a Cold Fusion user by trade and am diving head first into PHP. I like it a bunch. "Ron Gallant" <rongallant@email.com> wrote in message news:20010818221303.94053.qmail@pb1.pair.com... > I get > Warning: Wrong parameter count for explode() in > /www/chizeledlight/test.php on line 39 > when I use this code. > > The line in error is > explode($row); > > > "Hugh Bothwell" <hugh_bothwell@hotmail.com> wrote in message > news:20010818215411.85729.qmail@pb1.pair.com... > > > > "Ron Gallant" <rongallant@email.com> wrote in message > > news:20010818212439.77139.qmail@pb1.pair.com... > > > And my table results are shown 2 times per row. > > > http://www.chizeledlight.com/test.php > > > > .. at a guess, you requested the same field twice > > in your SELECT statement. > > > > I don't like the sample code given because it just > > iterates through the rows rather than using their > > names - if you alter your SQL, it could change the > > column order, which is kinda non-intuitive. > > > > > I also don't know how to specify the column I want the result from. > Like > > > $columnName. > > > > Try this instead: > > > > $query = > > "SELECT field1,field2,field3 " > > ."FROM tablename "; > > $result = mysql_query($query); > > > > while ($row = mysql_fetch_array($result)) { > > explode($row); > > echo > > "\n<tr><td>$field1</td><td>$field2</td><td>$field3</td></tr>"; > > } > > > > > >

« previous php.db (#11508) next »