making an auto link, around this record

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

hey,

I got this code below,

PHP Code: [ Select ]
$result = mysql_query("SELECT * FROM members",$db);
 
echo "<BR><TABLE CLASS=maintable size=95% align=center>";
 
echo"<font align=center>All details here</font><br><br><td width=15% class=maintable>Username<b></td><td width=15% class=maintable>link<b></td>";
 
while ($myrow = mysql_fetch_array($result))
 
{
 
echo "<TR class=maintable><TD bgcolor=006699>";
 
echo $myrow["username"];
 
echo "<TD bgcolor=006699>";
 
echo $myrow["a href=$_SERVER/members.php?member=["name"]>click here</a>"];
 
}
  1. $result = mysql_query("SELECT * FROM members",$db);
  2.  
  3. echo "<BR><TABLE CLASS=maintable size=95% align=center>";
  4.  
  5. echo"<font align=center>All details here</font><br><br><td width=15% class=maintable>Username<b></td><td width=15% class=maintable>link<b></td>";
  6.  
  7. while ($myrow = mysql_fetch_array($result))
  8.  
  9. {
  10.  
  11. echo "<TR class=maintable><TD bgcolor=006699>";
  12.  
  13. echo $myrow["username"];
  14.  
  15. echo "<TD bgcolor=006699>";
  16.  
  17. echo $myrow["a href=$_SERVER/members.php?member=["name"]>click here</a>"];
  18.  
  19. }


Ok above it has been connecting, works fine but i want to make a link around where it says


PHP Code: [ Select ]
echo $myrow["a href=$_SERVER/members.php?member=["name"]>click here</a>"];


I tried all sorts of ways on trying to make the link. Can someone please guide me? where it says "name" that is the member name from the records row.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

i changed it around so its now:


PHP Code: [ Select ]
 
echo"<font align=center>All details here</font><br><br><td width=15% class=maintable>Username<b></td><td width=15% class=maintable>link<b></td>";
 
while ($myrow = mysql_fetch_array($result))
 
{
 
echo "<TR class=maintable><TD bgcolor=006699>";
 
echo $myrow["username"];
 
echo "<TD bgcolor=006699>";
 
echo $myrow['<a href=$_SERVER/members.php?member=["name"]>click here</a>'];
 
}
 
 
  1.  
  2. echo"<font align=center>All details here</font><br><br><td width=15% class=maintable>Username<b></td><td width=15% class=maintable>link<b></td>";
  3.  
  4. while ($myrow = mysql_fetch_array($result))
  5.  
  6. {
  7.  
  8. echo "<TR class=maintable><TD bgcolor=006699>";
  9.  
  10. echo $myrow["username"];
  11.  
  12. echo "<TD bgcolor=006699>";
  13.  
  14. echo $myrow['<a href=$_SERVER/members.php?member=["name"]>click here</a>'];
  15.  
  16. }
  17.  
  18.  


the page now works and table shows but the links do not show.
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

PHP Code: [ Select ]
 
echo"<font align=center>All details here</font><br><br><td width=15% class=maintable>Username<b></td><td width=15% class=maintable>link<b></td>";
 
while ($myrow = mysql_fetch_array($result))
 
{
 
echo "<TR class=maintable><TD bgcolor=006699>";
 
echo $myrow["username"];
 
echo "<TD bgcolor=006699>";
 
$member = $myrow["name"];
 
echo "<a href=\"members.php?member=$member\">click here</a>";
 
echo "</TD>";
 
}
 
 
 
 
  1.  
  2. echo"<font align=center>All details here</font><br><br><td width=15% class=maintable>Username<b></td><td width=15% class=maintable>link<b></td>";
  3.  
  4. while ($myrow = mysql_fetch_array($result))
  5.  
  6. {
  7.  
  8. echo "<TR class=maintable><TD bgcolor=006699>";
  9.  
  10. echo $myrow["username"];
  11.  
  12. echo "<TD bgcolor=006699>";
  13.  
  14. $member = $myrow["name"];
  15.  
  16. echo "<a href=\"members.php?member=$member\">click here</a>";
  17.  
  18. echo "</TD>";
  19.  
  20. }
  21.  
  22.  
  23.  
  24.  


Try this. Remember that if you use single quotes any variables inside the single quotes will not be displayed
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

what do the "\" and the "\" stand for?
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

it is escaping the double quote character. Basically tellint php to process it as part of the string and not like it normally would
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

oh, thanks. Will help with my future learning. :D

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 69 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.