Jay2391 Posted October 3, 2007 Share Posted October 3, 2007 I need to pull some name from a db and as they show they all have a hyperlink that will show each users profile.... i did this but it is not working...any ideas.... <?php $q= "SELECT * FROM $users ORDER BY id DESC"; $r = mysql_query($q); while($row = mysql_fetch_array($r)){ $id = $row['id']; $location = $row['location']; print '<table width="600" border="0" cellspacing="0" cellpadding="0"><tr> <tr> <td width="100" height="12" align="center" valign="middle" nowrap="nowrap" scope="col"> <div align="left" class="style9"><a href=\"info.php?id=$id\">' .$id. '</a></div></td> </tr></table>'; } ?> Link to comment https://forums.phpfreaks.com/topic/71725-array-with-hyperlink/ Share on other sites More sharing options...
marcus Posted October 3, 2007 Share Posted October 3, 2007 With the hyperlink in place you're using single quotes to try to emit a variable. Either escape the variable in the URL the way you escaped it when calling the text in between, or print the table cell with double quotes and escape those. Link to comment https://forums.phpfreaks.com/topic/71725-array-with-hyperlink/#findComment-361174 Share on other sites More sharing options...
Jay2391 Posted October 3, 2007 Author Share Posted October 3, 2007 i do quite got what you said can you give me an example Link to comment https://forums.phpfreaks.com/topic/71725-array-with-hyperlink/#findComment-361204 Share on other sites More sharing options...
Barand Posted October 4, 2007 Share Posted October 4, 2007 In you print statement, swap the double quotes and single quotes. $id = 42; print '$id'; // --> $id print "$id"; // --> 42 Link to comment https://forums.phpfreaks.com/topic/71725-array-with-hyperlink/#findComment-361306 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.