Page 1 of 3

[REQUEST] Character Status On Userpanel

PostPosted: Thu Jan 24, 2013 2:56 am
by rave
Hello, Can Anyone Help Me With Script On How Can I Put All 5 Characters Status On My Userpanel

Sample:
On Userpanel I Can See My 5 Character's

Name:
Class:
Zulie:
Str:
Dex:
Int:
Con:
Cha:
Sen:
Reborn

Is That Possible
If Yes? What Is The Script For That?

Thanks : )

Re: [REQUEST] Character Status On Userpanel

PostPosted: Thu Jan 24, 2013 5:14 am
by Circa
Are you even trying to learn?

You seem to ask for a lot of help and code to be given to you.

Re: [REQUEST] Character Status On Userpanel

PostPosted: Thu Jan 24, 2013 11:26 am
by rave
Circa wrote:Are you even trying to learn?

You seem to ask for a lot of help and code to be given to you.


i tried but it doesnt work sorry sir

Re: [REQUEST] Character Status On Userpanel

PostPosted: Thu Jan 24, 2013 4:58 pm
by observe
  1. <?PHP
  2. $username = ''; // The clients username
  3. $sql = "SELECT * FROM characters WHERE account_name='".$username."'";
  4. $res = mysql_query($sql) or die(mysql_error());
  5.  
  6. if(mysql_num_rows($res) > 0){
  7.     while($row = mysql_fetch_assoc($res)){
  8.         echo("<div class="character">");
  9.         echo("<span class="charname">".$row['char_name']."</span>");
  10.         echo("<div class="stats">");
  11.         echo("<span class="sub">Strength:</span>");
  12.         echo("<span class="value">".$row['str']."</span>);
  13.         echo("</div>");
  14.     }
  15. }
  16. ?>


This is a quick example of how to select all the characters data from that account
No security added at this point this is just how to do it

Just make the $username variable on top be filled with the username of the specific client to gather its information

Re: [REQUEST] Character Status On Userpanel

PostPosted: Thu Jan 24, 2013 5:35 pm
by Circa
rave wrote:]

i tried but it doesnt work sorry sir


well at least show what you've tried, so people can tell you what you did wrong or why it isn't working.

Re: [REQUEST] Character Status On Userpanel

PostPosted: Thu Jan 24, 2013 8:27 pm
by observe
Circa wrote:
rave wrote:]

i tried but it doesnt work sorry sir


well at least show what you've tried, so people can tell you what you did wrong or why it isn't working.


Its a [REQUEST] topic anyways so it doesnt realy matter to let him show what he got till now

Re: [REQUEST] Character Status On Userpanel

PostPosted: Fri Jan 25, 2013 1:22 am
by rave
Circa wrote:
rave wrote:]

i tried but it doesnt work sorry sir


well at least show what you've tried, so people can tell you what you did wrong or why it isn't working.


  1. <?php
  2. $sql = "SELECT char_name FROM characters";
  3. $sql = sprintf($sql, $_SESSION['characters']);
  4.  
  5. $res = mysql_query($sql);
  6. if ( $res === false ) {
  7. echo 'something wrong ';
  8. } else {
  9. $currentDon = mysql_result($res, 0);
  10.  
  11. echo '<span id="dfgdfg">Character Name:  </span>'  . $currentchar_name;
  12. }?><br />


it only shows the name of my 1st character
dont know what comes next

Re: [REQUEST] Character Status On Userpanel

PostPosted: Fri Jan 25, 2013 1:46 am
by observe
rave wrote:
Circa wrote:
rave wrote:]

i tried but it doesnt work sorry sir


well at least show what you've tried, so people can tell you what you did wrong or why it isn't working.


  1. <?php
  2. $sql = "SELECT char_name FROM characters";
  3. $sql = sprintf($sql, $_SESSION['characters']);
  4.  
  5. $res = mysql_query($sql);
  6. if ( $res === false ) {
  7. echo 'something wrong ';
  8. } else {
  9. $currentDon = mysql_result($res, 0);
  10.  
  11. echo '<span id="dfgdfg">Character Name:  </span>'  . $currentchar_name;
  12. }?><br />


it only shows the name of my 1st character
dont know what comes next


The current way will only grab the first result just put it in a loop

Re: [REQUEST] Character Status On Userpanel

PostPosted: Fri Jan 25, 2013 7:03 am
by rave
observe wrote:
i tried but it doesnt work sorry sir

well at least show what you've tried, so people can tell you what you did wrong or why it isn't working.

[code=text]<?php
$sql = "SELECT char_name FROM characters";
$sql = sprintf($sql, $_SESSION['characters']);
 
$res = mysql_query($sql);
if ( $res === false ) {
echo 'something wrong ';
} else {
$currentDon = mysql_result($res, 0);
 
echo '<span id="dfgdfg">Character Name:  </span>'  . $currentchar_name;
}?><br />

it only shows the name of my 1st character
dont know what comes next

The current way will only grab the first result just put it in a loop


sorry sir but how
really sorry im noob at this

Re: [REQUEST] Character Status On Userpanel

PostPosted: Fri Jan 25, 2013 7:37 am
by observe
try using this code:
  1. <?PHP
  2. $username = ''; // The clients username
  3. $sql = "SELECT * FROM characters WHERE account_name='".$username."'";
  4. $res = mysql_query($sql) or die(mysql_error());
  5.  
  6. if(mysql_num_rows($res) > 0){
  7.     while($row = mysql_fetch_assoc($res)){
  8.         echo("<div class="character">");
  9.         echo("<span class="charname">".$row['char_name']."</span>");
  10.         echo("<div class="stats">");
  11.         echo("<span class="sub">Strength:</span>");
  12.         echo("<span class="value">".$row['str']."</span>);
  13.         echo("</div>");
  14.     }
  15. }
  16. ?>


the $username variable will prolly be set in your login script (maybe with a cookie or a SESSION)
the rest is pretty self explainatory