vzwhaley Posted February 28, 2006 Share Posted February 28, 2006 Hello everyone and thanks much for your past help.I am wanting to pull two records from a database and give each of them a named anchor link based on a number, such as $i = 0; and increment that number for each record. In other words, the first named anchor would be #0 and the second one would be #1, and so on.I can't seem to get this to work with the following code. Any tips or suggestions would be greatly appreciated.[code]do {for ($i = 0; $i <= 1; $i++) { echo "<b><a href=#".$i." class=\"TopStories\">".$RSMiddle2['Title']."</a></b><br>";} } while ($RSMiddle2 = mysql_fetch_array($Recordset2)); [/code] Quote Link to comment https://forums.phpfreaks.com/topic/3720-problem-with-named-anchors/ Share on other sites More sharing options...
khburres Posted March 2, 2006 Share Posted March 2, 2006 [!--quoteo(post=350128:date=Feb 27 2006, 10:20 PM:name=vzwhaley)--][div class=\'quotetop\']QUOTE(vzwhaley @ Feb 27 2006, 10:20 PM) [snapback]350128[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]echo "<b><a href=#".$i." class=\"TopStories\">".$RSMiddle2['Title']."</a></b><br>";[/code][/quote]try including quotation marks:[code]echo '<b><a href="#' . $i . '" class...</a>';[/code]Also, do you have the actual anchors somewhere in your html?i.e., do you have corresponding <a name="1"></a>, <a name="2"></a>? Quote Link to comment https://forums.phpfreaks.com/topic/3720-problem-with-named-anchors/#findComment-13585 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.