Badge System Error

Posted on Sunday 20th July 2008 at 03:37 AM
UrbanTwitch
UrbanTwitch's Avatar
PHP Code
  1. <?php include("/home/jsfdan/public_html/includes/vtop.php"); ?>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  3. "https://www.w3.org/TR/html4/strict.dtd">
  4.  
  5. <html>
  6. <head>
  7. <title>Members - sodaDome.com</title>
  8. <link rel="shortcut icon" href="https://sodadome.com/favicon.ico">
  9. <meta name="Description" content="About Me.">
  10. <meta name="Keywords" content="sodaplay, sodarace, soda ltd, physics, education, science, gravity, mass, friction, javascript_freek, dan jasnowski, sodaplay, sodarace, sodaconstructor, models, moovl, ed burton, soda">
  11.  
  12. <?php include("/home/jsfdan/public_html/temp2/includes/titleheader.php"); ?>
  13. </head>
  14.  
  15. <?php include("/home/jsfdan/public_html/temp2/includes/greenlinks.php"); ?>
  16.  
  17. <?php include("/home/jsfdan/public_html/temp2/includes/leftmenu.php"); ?>
  18.  
  19. <!-- START BODY CONTENT -->
  20.  
  21. <div id=title>Memberlist</div>
  22.  
  23. <?php
  24. echo "";
  25. if(isset($_GET['user'])) { //if there trying to view a profile
  26. //gets the user name and makes it safe
  27. $username = addslashes($_GET[user]);
  28. //querys the db to find the username
  29. $getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");
  30. //checks see if the username exists in the db
  31. $usernum = mysql_num_rows($getuser);
  32. //if it don't exist
  33. if($usernum == 0)
  34.  
  35. {
  36. //don't exist
  37.  
  38. echo ("User Not Found. Try again.");
  39.  
  40. }
  41. //if it does exist then show there profile
  42. else{
  43. $user = mysql_fetch_array($getuser);
  44. $user_rank = mysql_fetch_array(mysql_query("SELECT * FROM `groups` WHERE `lvlnum` = '$user[userlevel]';"));
  45.  
  46. echo "
  47. <div id=title>$user[username]'s Profile</div><br>
  48. <img src='$user[avvy]' width='100px' height='100px' title='$user[username]&#39;s avatar' border='0'><br>
  49. <br><b>Last Seen:</b> $user[last_seen]<br>
  50. <div style=padding-top: 0px;background-image: url(https://sodadome.com/sc2.gif); background-repeat: repeat-x;height: 18px;></div>
  51. <b>Member No.:</b> $user[id]<br>
  52. <b>User Rank:</b> $user_rank[full_name]<br>";
  53. if($user[ehidden] == "no"){
  54. echo "<b>Email:</b> <i>Hidden</i>";
  55. }else{
  56. echo "<b>Email:</b> $user[email]";
  57. }
  58. if($user[online] >= $offline){
  59. $online = "<span style='color:green;font-weight:bold;'>Online</span>";
  60. }else{
  61. $online = "<span style='color:red;font-weight:bold;'>Offline</span>";
  62. }
  63. echo "
  64. <b>Status:</b> $online<br><br><br>";
  65. while($l = mysql_fetch_array($findbadges)) {
  66. $findinfo = mysql_query("SELECT * FROM badges WHERE `username` = '$user[username]'");
  67. while($p = mysql_fetch_array($findinfo)) {
  68. if($l[bname] == $p[name]) {
  69. echo "<img alt='$p[desc]' border='0' src='$p[url]'><br> $p[desc]";
  70. }
  71. }
  72. }
  73. echo "<br><br><br>
  74. <b>Location:</b> $user[location]<br>
  75. <b>Gender:</b> $user[sex]<br>
  76. <b>Join Date:</b> $user[signupdate]<br>
  77. <b>Age:</b> $user[age]<br>
  78. <b>MSN:</b> $user[msn]<br>
  79. <b>AIM:</b> $user[aim]<br>
  80. <b>Website:</b> $user[website]<br>
  81. <b>About Me</b><br> $user[about]<br><br>
  82. <hr>
  83. <a href=https://sodadome.com/members.php>Return to Member List</a><br><br>
  84.  
  85. ";
  86. }
  87. }else{
  88. //gets all the members from the database
  89. $getusers = mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error());
  90. //loops there name out
  91. echo "<table><tr><td>ID</td><td>Username</td></tr>";
  92. while ($user = mysql_fetch_array($getusers)) {
  93. echo "<tr><td>$user[id] </td><td> <a href='members.php?user=$user[username]'>$user[username]</a></td></tr>";
  94. }
  95. }
  96. echo "</table>";
  97. ?>
  98.  
  99. <?php
  100.  
  101. //Query database & Counts the rows in the members database
  102. $count = mysql_num_rows(mysql_query('SELECT * FROM `members`'));
  103.  
  104. echo 'Members: ' . $count . '';
  105.  
  106. $new = mysql_fetch_array(mysql_query("SELECT * FROM `members` ORDER BY `id` DESC LIMIT 0, 1")); //Gets the newest member
  107. echo "<br>Newest User: " . $new[username]; //Displays the newest member
  108. ?>
  109.  
  110.  
  111.  
  112. <div id=title>Users online</div>
  113. <?php
  114. include("online.php"); //get online configuration and such
  115. $get_online_users = mysql_query("SELECT * FROM `members` WHERE `online` >= '$offline' ORDER BY `userlevel` ASC"); //get all online users
  116. $total_users = mysql_num_rows($get_online_users);
  117. if($total_users == 0){ //see if anyone is logged in
  118. echo "No Users Online!"; //there isn't =O
  119. }else{ //maybe....
  120. $i = 1; //the variable 'i' is 1
  121. while($online = mysql_fetch_array($get_online_users)){ //loop online users
  122. if(($i > 0) && ($i != $total_users)){ //see if i is the same or not of total online users
  123. $comma = ', '; //if it isn't then theres a comma
  124. }else{ //or....
  125. $comma = ''; //if there isn't theres no comma
  126. } //end check
  127. echo "<a href='members.php?user=$online[username]'>$online[username]</a>$comma"; //echo the online users with the comma
  128. } //end loop
  129. } //end
  130. ?>
  131.  
  132.  
  133. <!-- END BODY CONTENT -->
  134.  
  135. <?php include("/home/jsfdan/public_html/temp2/includes/footer.php"); ?>


Line 66: $findinfo = mysql_query("SELECT * FROM badges WHERE `username` = '$user[username]'");

I get error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/jsfdan/public_html/members.php on line 66

Help.
Login or register to respond to this forum topic.