darkcarnival Posted April 2, 2006 Share Posted April 2, 2006 hi,probabley a dumb question but I'm curious about this.i have a template class created and its pretty good though it has one limitation, loops. it doesnt work well at all with loops. my solution place the loops in a function and call them in the template, it works.but it seems to kill off the customablity a bit which is where this question comes in.is there a way to draw out the variables made by the loop by plaxcing them into an array?hard to phrase this so i'll write out an example of what i mean:[code]function loop_thing(){//sql query stuff herewhile($row = mysql_fetch_assoc($sql_r)){$results = array($row['colume1'], $row['Colume2'], $row['colume3']);}return $results;}//then to output:$results = loop_thing();echo $result[0]. "<br>";echo $result[1]. "<br>";echo $result[2];[/code]would something like that work?thanks. Quote Link to comment Share on other sites More sharing options...
Zane Posted April 2, 2006 Share Posted April 2, 2006 Yes, you can do thisSame script but modified[code]function loop_thing(){//sql query stuff here$results = array();$i = 0;while($row = mysql_fetch_array($sql_r, MYSQL_NUM)){ $results[] = $row[$i];}return $results;}//then to output:$results = loop_thing();echo $result[0]. "<br>";echo $result[1]. "<br>";echo $result[2];[/code] Quote Link to comment Share on other sites More sharing options...
darkcarnival Posted April 2, 2006 Author Share Posted April 2, 2006 thats great to hear :Dthanks. 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.