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]
[!--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>?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.