StanLytle Posted March 21, 2007 Share Posted March 21, 2007 I've tried several different ways and can't get the output to generate a link. Here's the code: <? $query = "SELECT UserID, COUNT(UserID), SUM(Views) FROM Photos GROUP BY UserID"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "There are ". $row['COUNT(UserID)'] ." photos and ". $row['SUM(Views)'] ." views for user ". $row['UserID'] ."" ?><a href=Search.php?SearchUserID='UserID'&Search=Search>Search</a><?; echo "<br />"; } ?> Here's what the output looks like: There are 52 photos and 932 views for user 2Search Everything I have tried generates an unexpected error code. I'd like the UserID number to be a clickable link, that generates code that says "Search.php?SearchUserID='UserID'&Search=Search>Search" where UserID number is the same value as returned with the "$row['UserID']" function. Thanks, Stan Link to comment https://forums.phpfreaks.com/topic/43705-solved-cant-create-html-link/ Share on other sites More sharing options...
Barand Posted March 21, 2007 Share Posted March 21, 2007 try <?php $query = "SELECT UserID, COUNT(UserID), SUM(Views) FROM Photos GROUP BY UserID"; $result = mysql_query($query) or die(mysql_error()); while(list($id, $ct, $sum) = mysql_fetch_row($result)) { echo "There are $ct photos and $sum views for user $id <a href='Search.php?SearchUserID=$id&Search=Search'>Search</a><br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/43705-solved-cant-create-html-link/#findComment-212294 Share on other sites More sharing options...
StanLytle Posted March 22, 2007 Author Share Posted March 22, 2007 Hello Barand: That works slick. Just what I needed. Thanks for your time. Stan Link to comment https://forums.phpfreaks.com/topic/43705-solved-cant-create-html-link/#findComment-212832 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.