I can to make links from the userid and name in browse users results, but I don't understand why I can't make a href links anywhere within other PHP code even if I use the same syntax as I have used for mysql_fetch_array. Why is this?
I have tried the following, but having spent a long time moving 's and "s I posted this question
echo "a href="send_message.php?sendto='.$row->userid."'> ".$row->userid."";
or
echo "a href="send_message.php?sendto='.$row['userid']."'> ".$row['userid']."";





pr0gr4mm3r posted this at 18:27—28th March 2008.
He has: 470 posts
Joined: Sep 2006
You are missing some HTML tag information, this should work:
<?phpecho '<a href="send_message.php?sendto=' . $row['userid'] . '">' . $row['name'] . '</a>';
?>
I am pretty sure you are fetching the rows as an array, so you access the user id with $row['userid'], not $row->userid.
You may want to look over the PHP manual page on Strings for more information on echoing strings as well as concatenation.
drew22299 posted this at 19:49—28th March 2008.
He has: 107 posts
Joined: Mar 2006
I tried that, and then I realised that the userid for the user profile that is being viewed by the logged in user, is passed with a link using view_profile.php?id=userid, does this mean I can use something like the following?
echo 'a href="send_message.php?sendto=' . userid='$_GET[id] . '">' . userid='$_GET[id] . '';
Also, it's not using a mysql_fetch_array on this page, so not sure what the other ways to write this string. I looked at the link for PHP strings but there is nothing about a href and strings there.
www.hotlista.co.uk