imarockstar Posted May 13, 2008 Share Posted May 13, 2008 hey guys .. I have the following code on my site. it is working just find . however ... I want to display the $pmsid data in place of the $userid at the end of the http://www.myspace.com/ url. <div class="tag_cloud_pad_left"> <?php function get_tag_data() { $result = mysql_query("SELECT * FROM plus_signup GROUP BY userid ORDER BY num_votes DESC"); while($row = mysql_fetch_array($result)) { $arr[$row['userid']] = $row['num_votes']; } ksort($arr); return $arr; } function get_tag_cloud() { // Default font sizes $min_font_size = 12; $max_font_size = 30; // Pull in tag data $tags = get_tag_data(); $minimum_count = min(array_values($tags)); $maximum_count = max(array_values($tags)); $spread = $maximum_count - $minimum_count; if($spread == 0) { $spread = 1; } $cloud_html = ''; $cloud_tags = array(); // create an array to hold tag code foreach ($tags as $userid => $num_votes) { $size = $min_font_size + ($num_votes - $minimum_count) * ($max_font_size - $min_font_size) / $spread; $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' . '" class="tag_cloud" href="http://www.myspace.com/' . $userid . '" title="\'' . $userid . '\' returned a count of ' . $num_votes . '">' . htmlspecialchars(stripslashes($userid)) . '</a>'; } $cloud_html = join("\n", $cloud_tags) . "\n"; return $cloud_html; } ?> <h2 class=side>myspace cloud</h2> <?php print get_tag_cloud(); ?> </div> the above is the full code ... the following is the code that i need changed, but i cant figure it out .. $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' . '" class="tag_cloud" href="http://www.myspace.com/' . $userid . '" title="\'' . $userid . '\' returned a count of ' . $num_votes . '">' . htmlspecialchars(stripslashes($userid)) . '</a>'; after the myspace.com link i want $userid changed to show the myspace id of that person which is $pmsid. I cant figure out how to pul that info from the mysql quriey and it pop up there. Quote Link to comment Share on other sites More sharing options...
imarockstar Posted May 13, 2008 Author Share Posted May 13, 2008 anyone ... anyone ? Quote Link to comment Share on other sites More sharing options...
runnerjp Posted May 13, 2008 Share Posted May 13, 2008 $query = "SELECT * FROM tablename WHERE id = how ever you get the users id LIMIT 1"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $pmsid = $array['msid??']; (array is $array['table name for what you want'] Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 13, 2008 Share Posted May 13, 2008 Where are you getting $pmsid from? Quote Link to comment Share on other sites More sharing options...
runnerjp Posted May 13, 2008 Share Posted May 13, 2008 surly $pmsid is stored in his table allready Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 13, 2008 Share Posted May 13, 2008 Surely, it'd be better if he told us. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted May 13, 2008 Share Posted May 13, 2008 haha ture.. lol im tryin to attack my lack of php knowlege by attempting to solve other problems.. im just jumpin in haha Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 13, 2008 Share Posted May 13, 2008 Sorry if this is uncalled for, but how did you get 1,056 posts with a "lack of php knowledge"? =X Quote Link to comment Share on other sites More sharing options...
runnerjp Posted May 13, 2008 Share Posted May 13, 2008 haha ok i know basics... but basicly iv learnt through here... done some topic solvin and posted sum errors... 1 to which took many posts lol... just cos i got lots of posts dont make me good... probs makes me bad lol goota learn sum way tho... least im tryin to give back lol Quote Link to comment Share on other sites More sharing options...
imarockstar Posted May 14, 2008 Author Share Posted May 14, 2008 What I want replaced is $userid ... $pmsid is a value stored in the table im using. so instead of http://www.myspace.com/ $userid i want so instead of http://www.myspace.com/ $pmsid but when I throw that in there I get no output. in every user $pmsid has a value ..so i know that there is somthing there to show Quote Link to comment Share on other sites More sharing options...
runnerjp Posted May 14, 2008 Share Posted May 14, 2008 ahh u mean u want to do a url chnage ??? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 14, 2008 Share Posted May 14, 2008 You need to set $pmsid. while($row = mysql_fetch_array($result)) { $arr[$row['pmsid']] = $row['num_votes']; } Yeah. >_> Quote Link to comment Share on other sites More sharing options...
imarockstar Posted May 14, 2008 Author Share Posted May 14, 2008 I already did that ... but if you notice, I also need to use $userid in the output ... $userid = the name of the tag $pmsid = the myspace id of the user here is the location : http://www.themyspacecontest.com/tag_cloud.php you can see when they are rolled over the link is http://www.myspace.com/($userid) but I need it to be there myspace id whic is stored in $pmsid Quote Link to comment Share on other sites More sharing options...
imarockstar Posted May 15, 2008 Author Share Posted May 15, 2008 help help !!! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 15, 2008 Share Posted May 15, 2008 $pmsid isn't included in the output from the function get_tag_data. so i would modify this function to store $pmsid as well: function get_tag_data() { $result = mysql_query("SELECT * FROM plus_signup GROUP BY userid ORDER BY num_votes DESC"); while($row = mysql_fetch_array($result)) { // $arr[$row['userid']] = $row['num_votes']; I would change this to: $arr[$row['userid']] = array($row['num_votes'], $row['pmsid']); } ksort($arr); return $arr; } then update all code as required to handle the new array. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.