Megachunk Posted May 12, 2015 Share Posted May 12, 2015 Hello. I have this code that is creating tables and columns and making the links, but its not grabbing the userId to take it to the next page. Please see attached page: Am I trying to make the links grab the associated userId to take it to the page of that Id. Any help is greatly appreciated. Thanks in advance. Mike artists.php Link to comment https://forums.phpfreaks.com/topic/296243-not-grabbing-userid-for-linkurl/ Share on other sites More sharing options...
Ch0cu3r Posted May 12, 2015 Share Posted May 12, 2015 You need to use the $artist['userid'] variable for setting the userid in your link, example echo '<a href="artists_details.php?userId='.$artist['userid'].'"> ... </a>'; Link to comment https://forums.phpfreaks.com/topic/296243-not-grabbing-userid-for-linkurl/#findComment-1511597 Share on other sites More sharing options...
Megachunk Posted May 12, 2015 Author Share Posted May 12, 2015 Being a newbie, I'm not sure how to implement it in my existing code. I tried inserting it into where the span class .artist is, but it doesn't seem to work for me. How could I associate it with what I have? thanks in advance: I really appreciate the help! <?php $currentColumn=0; echo "<tr>".PHP_EOL; while($artist = mysql_fetch_assoc($rs_artistNames)) { $currentColumn = $currentColumn +1; echo " <td align='left'><B><a href='artists_details.php?userId='<span class=.artist'>".$artist['artistName']." ".$artist['lastName']."</B></a> <BR> ".$artist['bandName']."</span></td>".PHP_EOL; //the modulo function (%) returns 0 if evenly divisible if($currentColumn % 4 == 0) { echo "</tr>".PHP_EOL; echo "<tr>".PHP_EOL; } } echo "</tr>".PHP_EOL; ?> Link to comment https://forums.phpfreaks.com/topic/296243-not-grabbing-userid-for-linkurl/#findComment-1511603 Share on other sites More sharing options...
Ch0cu3r Posted May 12, 2015 Share Posted May 12, 2015 Currently your link is invalid html. If you look at my post you will see I posted the correct syntax for your link. The artists span goes where the ... is in my code. Also when adding the name of a class to a html tag you don't include the period in the class name. Link to comment https://forums.phpfreaks.com/topic/296243-not-grabbing-userid-for-linkurl/#findComment-1511604 Share on other sites More sharing options...
Megachunk Posted May 12, 2015 Author Share Posted May 12, 2015 Thanks very much! This should help. Still having a bit of trouble getting it to work, but I should be able to figure it out with what I've got. The page makes the links now but doesn't connect to the userId. I really appreciate the help! Thanks so much! Mike Link to comment https://forums.phpfreaks.com/topic/296243-not-grabbing-userid-for-linkurl/#findComment-1511610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.