presso Posted October 22, 2006 Share Posted October 22, 2006 i am using the following code , which seems to work fine at pulling the info the problem is that it is only displaying one line of the result , how or what is the best way for it to display all 10 lines of info as per the amount of results the query has returned. [code]$query = $DB->query("SELECT name, date, location FROM table ORDER BY name DESC LIMIT 10");while ($info = $DB->fetch_row($query))$id = $info['name'];$date = $info['date'];$loc = $info['location']; {$content .= "<tr> <td width=\"100%\" nowrap=\"nowrap\" <div class=\"smallfont\" style=\"text-decoration: none;\">$name</a></div></td><td align=\"right\" nowrap=\"nowrap\"<div class=\"smallfont\"> $date</div></td><td align=\"right\" nowrap=\"nowrap\"<div class=\"smallfont\"> $location</div></td></tr> ";} [/code] Quote Link to comment Share on other sites More sharing options...
trq Posted October 22, 2006 Share Posted October 22, 2006 Your syntax is a little whack and your using undeclared variables.[code=php:0]$query = $DB->query("SELECT name, date, location FROM table ORDER BY name DESC LIMIT 10");while ($info = $DB->fetch_row($query)) { $id = $info['name']; $date = $info['date']; $loc = $info['location']; $content .= " <tr> <td width=\"100%\" nowrap=\"nowrap\" <div class=\"smallfont\" style=\"text-decoration: none;\">$id</a></div></td> <td align=\"right\" nowrap=\"nowrap\"<div class=\"smallfont\"> $date</div></td> <td align=\"right\" nowrap=\"nowrap\"<div class=\"smallfont\"> $loc</div></td> </tr>";}echo $content;[/code] Quote Link to comment Share on other sites More sharing options...
presso Posted October 22, 2006 Author Share Posted October 22, 2006 lol , yeah i know its out of whack , thats because its comming within a module , i cannot believe though that i missed having the curly bracket in the wrong postion thats all the problem was. I don't need to output it via echo $content; as $content is being passed to output by something else. Thanks for pointing out how stupid i was at not looking at my coding abit better, :) ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.