Jump to content

problem with named anchors


vzwhaley

Recommended Posts

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]
Link to comment
Share on other sites

[!--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>?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.