Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 329
0 Users 5 Guests Online
Forum Index » PHP + MySQL » Badge System Error
Posted on Sunday 20th July 2008 at 03:37 AM
UrbanTwitch
templates/default/images/noavatar.png's Avatar
Senior Member
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php include("/home/jsfdan/public_html/includes/vtop.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>Members - sodaDome.com</title>
<link rel="shortcut icon" href="http://sodadome.com/favicon.ico">
<meta name="Description" content="About Me.">
<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">

<?php include("/home/jsfdan/public_html/temp2/includes/titleheader.php"); ?>
</head>

<?php include("/home/jsfdan/public_html/temp2/includes/greenlinks.php"); ?>

<?php include("/home/jsfdan/public_html/temp2/includes/leftmenu.php"); ?>

<!-- START BODY CONTENT -->

<div id=title>Memberlist</div>

<?php
echo "";
if(isset(
$_GET['user'])) { //if there trying to view a profile
//gets the user name and makes it safe
$username addslashes($_GET[user]);
//querys the db to find the username
$getuser mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");
//checks see if the username exists in the db 
$usernum mysql_num_rows($getuser);
//if it don't exist 
if($usernum == 0


//don't exist

echo ("User Not Found. Try again."); 


//if it does exist then show there profile
else{
$user mysql_fetch_array($getuser); 
$user_rank mysql_fetch_array(mysql_query("SELECT  * FROM `groups` WHERE `lvlnum` = '$user[userlevel]';"));

echo 
"
<div id=title>
$user[username]'s Profile</div><br>
<img src='
$user[avvy]' width='100px' height='100px' title='$user[username]&#39;s avatar' border='0'><br>
<br><b>Last Seen:</b> 
$user[last_seen]<br>
<div style=padding-top: 0px;background-image: url(http://sodadome.com/sc2.gif); background-repeat: repeat-x;height: 18px;></div>
<b>Member No.:</b> 
$user[id]<br>
<b>User Rank:</b> 
$user_rank[full_name]<br>";
if(
$user[ehidden] == "no"){
echo 
"<b>Email:</b> <i>Hidden</i>";
}else{
echo 
"<b>Email:</b> $user[email]";
}
if(
$user[online] >= $offline){
    
$online "<span style='color:green;font-weight:bold;'>Online</span>";
}else{
    
$online "<span style='color:red;font-weight:bold;'>Offline</span>";
}
echo 
"
<b>Status:</b> 
$online<br><br><br>";
while(
$l mysql_fetch_array($findbadges)) {
$findinfo mysql_query("SELECT * FROM badges WHERE `username` = '$user[username]'");
while(
$p mysql_fetch_array($findinfo)) {
if(
$l[bname] == $p[name]) {
echo 
"<img alt='$p[desc]' border='0' src='$p[url]'><br> $p[desc]";
}
}
}
echo 
"<br><br><br>
<b>Location:</b> 
$user[location]<br>
<b>Gender:</b> 
$user[sex]<br>
<b>Join Date:</b> 
$user[signupdate]<br>
<b>Age:</b> 
$user[age]<br>
<b>MSN:</b> 
$user[msn]<br>
<b>AIM:</b> 
$user[aim]<br>
<b>Website:</b> 
$user[website]<br>
<b>About Me</b><br> 
$user[about]<br><br>
<hr>
<a href=http://sodadome.com/members.php>Return to Member List</a><br><br>

"
;
}
}else{
//gets all the members from the database
$getusers mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error()); 
//loops there name out 
echo "<table><tr><td>ID</td><td>Username</td></tr>";
while (
$user mysql_fetch_array($getusers)) { 
echo 
"<tr><td>$user[id] </td><td> <a href='members.php?user=$user[username]'>$user[username]</a></td></tr>"
}
}
echo 
"</table>";
?> 

<?php

//Query database & Counts the rows in the members database
$count mysql_num_rows(mysql_query('SELECT * FROM `members`'));

echo 
'Members: ' $count '';

$new mysql_fetch_array(mysql_query("SELECT * FROM `members` ORDER BY `id` DESC LIMIT 0, 1")); //Gets the newest member
echo "<br>Newest User: " $new[username]; //Displays the newest member
?> 



<div id=title>Users online</div> 
<?php
include("online.php"); //get online configuration and such
$get_online_users mysql_query("SELECT * FROM `members` WHERE `online` >= '$offline' ORDER BY `userlevel` ASC"); //get all online users
$total_users mysql_num_rows($get_online_users);
if(
$total_users == 0){ //see if anyone is logged in
    
echo "No Users Online!"//there isn't =O
}else{ //maybe....
    
$i 1//the variable 'i' is 1
    
while($online mysql_fetch_array($get_online_users)){ //loop online users
        
if(($i 0) && ($i != $total_users)){ //see if i is the same or not of total online users
            
$comma ', '//if it isn't then theres a comma
        
}else{ //or....
            
$comma ''//if there isn't theres no comma
        
//end check
        
echo "<a href='members.php?user=$online[username]'>$online[username]</a>$comma"//echo the online users with the comma
    
//end loop
//end
?> 


<!-- END BODY CONTENT -->

<?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.