Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-15-2009, 01:10 PM
alus1onZ alus1onZ is offline
Member
 
Join Date: Feb 2009
Posts: 2
Credits: 616
alus1onZ
Unhappy Problem with including a PHP script [SOLVED]

With my noobish php knowledge I've made a script that extract information from the mysql db and display it as a top 100 ranking of the adoptables. But the problem is I don't know how to replace the get content function in extrapage.php:

PHP Code:
$query "SELECT * FROM article_content WHERE page = 'extra'";
$result mysql_query($query);
$num mysql_numrows($result); 
With mine php top 100 script :(

Please if someone can tell me how to replace it I will be very thankful

Here it's the php Top 100 adoptables script, feel free to use it on your page if you want. It may have issues but as I say my knowledge in php is very poor. :)

PHP Code:
<?php
{
  
$getscores="SELECT totalclicks,name,currentlevel,owner,type from owned_adoptables order by totalclicks DESC limit 100";
  
$getscores2=mysql_query($getscores) or die("Could not get scores");
  
$rank=1;
  echo 
"<center><h3>Top 100 adoptables</h3></center><center>";
  echo 
"<table width=50%><tr><th>Position</th><th>Name</th><th>Clicks</th><th>Level</th><th>Owner</th><th>Type</th></tr>";
  while(
$getscores3=mysql_fetch_array($getscores2))
  {
     
$getscores3[name]=strip_tags($getscores3[name]);
     echo 
"<tr><td>$rank</td><td>$getscores3[name]</td><td>$getscores3[totalclicks]</td><td>$getscores3[currentlevel]</td><td>$getscores3[owner]</td><td>$getscores3[type]</td></tr>";
     
$rank++;
  }
  echo 
"</table></center><br><br>";
}
?>
[hr]
OK, I got it! :D

The easiest way is to add a div class style in the main.css then in extrapage.php place this before the top 100 code
Code:
echo "<div class=\"your div class"\>";
and after the top 100 code put this
Code:
echo "</div>";
so your php code will look something like this:

PHP Code:
  echo "<div class=\"top100\">";
{
  
$getscores="SELECT totalclicks,name,currentlevel,owner,type from owned_adoptables order by totalclicks DESC limit 100";
  
$getscores2=mysql_query($getscores) or die("Could not get scores");
  
$rank=1;
  echo 
"<center><h3>Top 100 adoptables</h3></center><center>";
  echo 
"<table width=50%><tr><th>Position</th><th>Name</th><th>Clicks</th><th>Level</th><th>Owner</th><th>Type</th></tr>";
  while(
$getscores3=mysql_fetch_array($getscores2))
  {
     
$getscores3[name]=strip_tags($getscores3[name]);
     echo 
"<tr><td>$rank</td><td>$getscores3[name]</td><td>$getscores3[totalclicks]</td><td>$getscores3[currentlevel]</td><td>$getscores3[owner]</td><td>$getscores3[type]</td></tr>";
     
$rank++;
  }
  echo 
"</table></center><br><br>";
}
  echo 
"</div>"
Best wishes, alus1onZ :P
Reply With Quote
  #2  
Old 02-15-2009, 05:07 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 13,401
BMR777 is on a distinguished road
Default RE: Problem with including a PHP script [SOLVED]

Glad you got it sorted. :)
Reply With Quote
  #3  
Old 02-15-2009, 07:02 PM
alus1onZ alus1onZ is offline
Member
 
Join Date: Feb 2009
Posts: 2
Credits: 616
alus1onZ
Default RE: Problem with including a PHP script [SOLVED]

Feel free to use it for further updates of the script, it will be nice to people have a top 100 module in their sites :)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Including a user set theme? blueskyler Questions and Supports 0 12-21-2011 04:12 PM
EDIT: Problem Solved :) PTGigi Questions and Supports 4 07-17-2009 10:12 PM
[SOLVED] trollis76 Questions and Supports 4 06-10-2009 01:50 PM
I think it's the script that's the problem. rosepose Questions and Supports 9 03-20-2009 03:09 PM


All times are GMT -5. The time now is 09:37 PM.

Currently Active Users: 809 (0 members and 809 guests)
Threads: 4,081, Posts: 32,029, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636