Have you created a useful tool? or Do you want to get help building one? This is the right place!
Mctavish
Posts: 140 Joined: Sat Aug 20, 2011 7:05 am
Location: Queen City of The South
Post
by Mctavish » Thu Oct 27, 2011 1:21 am
Hi i got this hero status script from one of the topic here, and could someone help me to add
class name and
clan_name ? i saw the same topic with this, but non is working, but i only need to add is character class and character clan name.. thanks ..
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="Windows-1251"> <meta http-equiv="Content-Style-Type" content="text/css"> <title>: Hero's</title> </head> <body bgcolor="#000000" style="color:#999999; font-family:verdana;"> <?php $db_user = "root"; //your sql username goes here $db_pass = ""; //your sql password goes here $db_name = ""; //your database name goes here $db_serv = "localhost"; //the address of the database goes here $db_port = "3306"; //the address of the database goes here $res = mysql_connect ( $db_serv, $db_user, $db_pass, $db_port ) or die ("Coudn't connect to server."); mysql_select_db ( $db_name ) or die ('Couldnt select database.'); //------------------------------------------------------------------------------------------------------------------------------------------------- $FORM2 = "<table width=400 style=\"font-size:11px; font-family:verdana; color:#999999;\" cellspacing=\"0\" cellpadding=\"0\" align=center> <tr> <td width=100% height=34 colspan=2 align=center class=\"content\" style=\"font-size:12px; font-family:verdana; color:#FFFFFF;\"><b>Heroes</b> </td> </tr> <tr> <td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Name</b></center></td> <td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Clan Name</b></center></td> <td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Count</b></center></td> </tr>"; $query = mysql_query("SELECT charId,count FROM heroes WHERE count >=1 ORDER BY count DESC") or die('Query failed!'); while ($res=mysql_fetch_array($query)) { $id=$res['charId']; $count=$res['count']; $char_name=mysql_query("SELECT char_name FROM characters WHERE charId='$id'"); $name = mysql_fetch_row( $char_name ); $FORM2 .= '<tr> <td style=\"font-size:10px; font-family:verdana; color:#999999;\" class=content align=center>'.$name[0].'</td> <td style=\"font-size:10px; font-family:verdana; color:#999999;\" class=content align=center>'.$res['count'].'</td> </tr>'; } echo $FORM2; mysql_close(); ?> </body> </html>
nonom
L2j Veteran
Posts: 649 Joined: Wed Mar 11, 2009 10:34 pm
Location: Magmeld
Post
by nonom » Thu Oct 27, 2011 10:49 am
It's an old PHP script probably posted here in any place
Code: Select all
<?php $server= "127.0.0.1"; $user = "your_user"; $pass = "your_pass"; $db = "your_db"; $con = mysql_connect($server, $user, $pass) or die(mysql_error()); mysql_select_db($db, $con) or die(mysql_error()); ?><table width="100%" border="0"> <tbody> <tr> <td>Player Name</td> <td>Class</td> <td>Clan</td> <td>Times Hero</td> </tr><?php$sql = mysql_query("SELECT * FROM heroes as h,characters as c WHERE h.charId = c.charId ORDER BY h.count DESC") or die(mysql_error());while($c = mysql_fetch_array($sql)) { $h = mysql_query("SELECT * FROM characters WHERE charId = '".$c['charId']."'") or die(mysql_error()); $n = mysql_fetch_array($h); $l = mysql_query("SELECT * FROM class_list WHERE id = '".$n['base_class']."'") or die(mysql_error()); $g = mysql_fetch_array($l); $i = mysql_query("SELECT * FROM clan_data WHERE clan_id = '".$n['clanid']."'") or die(mysql_error()); $j = mysql_fetch_array($i); $g['class_name'] = explode("_", $g['class_name']); $j['clan_name'] = empty($n['clanid']) ? 'No Clan' : $j['clan_name']; ?> <tr> <td><?php echo $n['char_name']; ?></td> <td><?php echo ucwords($g['class_name'][1]); ?></td> <td><?php echo $j['clan_name']; ?></td> <td><?php echo $c['count']; ?> </td> <? } ?> </tr> </tbody></table>
Last edited by
nonom on Thu Oct 27, 2011 11:16 am, edited 1 time in total.
"There are three kinds of people in this world, those who can count and those who can't"
Mctavish
Posts: 140 Joined: Sat Aug 20, 2011 7:05 am
Location: Queen City of The South
Post
by Mctavish » Thu Oct 27, 2011 10:52 am
any clue bout this error?
Code: Select all
Parse error: syntax error, unexpected $end in C:\wamp\www\heroes.php on line 37
nonom
L2j Veteran
Posts: 649 Joined: Wed Mar 11, 2009 10:34 pm
Location: Magmeld
Post
by nonom » Thu Oct 27, 2011 11:00 am
Mctavish wrote: any clue bout this error?
Code: Select all
Parse error: syntax error, unexpected $end in C:\wamp\www\heroes.php on line 37
Check your pasted code, this error means any { } is not properly closed. I was trying the script and it's working fine for me.
Be careful copy/pasting and probably you need to drop this line: Depending where you put your code, could be not needed.
"There are three kinds of people in this world, those who can count and those who can't"
Mctavish
Posts: 140 Joined: Sat Aug 20, 2011 7:05 am
Location: Queen City of The South
Post
by Mctavish » Thu Oct 27, 2011 11:09 am
nonom wrote: Mctavish wrote: any clue bout this error?
Code: Select all
Parse error: syntax error, unexpected $end in C:\wamp\www\heroes.php on line 37
Check your pasted code, this error means any { } is not properly closed. I was trying the script and it's working fine for me.
Be careful copy/pasting and probably you need to drop this line: Depending where you put your code, could be not needed.
i checked it.. but it's nothing diffrent with your post... i can't find what gives me an error .. could you check your post please? mb there are some missing lines.. thanks..
Code: Select all
<?php $server= "127.0.0.1"; $user = "your_user"; $pass = "your_pass"; $db = "your_db"; $con = mysql_connect($server, $user, $pass) or die(mysql_error()); mysql_select_db($db, $con) or die(mysql_error()); ?><table width="100%" border="0"> <tbody> <tr> <td>Player Name</td> <td>Class</td> <td>Clan</td> <td>Times Hero</td> </tr><?php$sql = mysql_query("SELECT * FROM heroes as h,characters as c WHERE h.charId = c.charId ORDER BY h.count DESC") or die(mysql_error());while($c = mysql_fetch_array($sql)) { $h = mysql_query("SELECT * FROM characters WHERE charId = '".$c['charId']."'") or die(mysql_error()); $n = mysql_fetch_array($h); $l = mysql_query("SELECT * FROM class_list WHERE id = '".$n['base_class']."'") or die(mysql_error()); $g = mysql_fetch_array($l); $i = mysql_query("SELECT * FROM clan_data WHERE clan_id = '".$n['clanid']."'") or die(mysql_error()); $j = mysql_fetch_array($i); $g['class_name'] = explode("_", $g['class_name']); $j['clan_name'] = empty($n['clanid']) ? 'No Clan' : $j['clan_name']; ?> <tr> <td><?php echo $n['char_name']; ?></td> <td><?php echo ucwords($g['class_name'][1]); ?></td> <td><?php echo $j['clan_name']; ?></td> <td><?php echo $c['count']; ?> </td> <? } ?> </tr> </tbody></table><?php mysql_close(); ?>
nonom
L2j Veteran
Posts: 649 Joined: Wed Mar 11, 2009 10:34 pm
Location: Magmeld
Post
by nonom » Thu Oct 27, 2011 11:15 am
Drop the Line 37. I did it in my post
"There are three kinds of people in this world, those who can count and those who can't"
Mctavish
Posts: 140 Joined: Sat Aug 20, 2011 7:05 am
Location: Queen City of The South
Post
by Mctavish » Thu Oct 27, 2011 11:23 am
same error
Code: Select all
Parse error: syntax error, unexpected $end in C:\wamp\www\heroes.php on line 37
the same result... this code hates me for sure..
nonom
L2j Veteran
Posts: 649 Joined: Wed Mar 11, 2009 10:34 pm
Location: Magmeld
Post
by nonom » Thu Oct 27, 2011 11:47 am
You have a PM with a demo URL. Try to use the clean script, cause is working for me
Be sure you aren't adding an additional ?> at end..
Also please, this post must be in
viewforum.php?f=94
"There are three kinds of people in this world, those who can count and those who can't"
WallMan
Posts: 42 Joined: Fri Oct 07, 2011 5:53 am
Post
by WallMan » Thu Dec 08, 2011 12:37 am
I was looking like this, thanks
I will test in my server