SF23103 Posted October 11, 2011 Share Posted October 11, 2011 I'm trying to loop "Question" as a list of links (link is #id_number), and then later on the page loop "Question" and "Answer", anchored by the id_number tag. It's looping "Question" just fine, but how do I then loop the same data again later in the same page? <?php $username="username"; $password="password"; $database="database_name"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM ft_form_17 WHERE Include='Include'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> Header Goes here<br /><br /><br /> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"question"); //Question $f2=mysql_result($result,$i,"answer"); //Answer $f3=mysql_result($result,$i,"submission_id"); //id number ?> <a href="#<?php echo $f3; ?>"><?php echo $f1; ?></a><br /> <?php $i++; } ?> <br /><br /><br /> <strong><a name="<?php echo $f3; ?>"><?php echo $f1; ?></a></strong> <?php echo $f2; ?> Quote Link to comment https://forums.phpfreaks.com/topic/248858-looping-the-same-data-on-the-same-page/ Share on other sites More sharing options...
trq Posted October 11, 2011 Share Posted October 11, 2011 mysql_data_seek. Quote Link to comment https://forums.phpfreaks.com/topic/248858-looping-the-same-data-on-the-same-page/#findComment-1278187 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.