[REQUEST] Character Status On Userpanel

This is guide mostly for website tools and code, for example CMS or registration scripts.
There can also be tools.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

[REQUEST] Character Status On Userpanel

Postby rave on Thu Jan 24, 2013 2:56 am

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 : )
rave
Clown
Clown
 
Posts: 459
Joined: Thu Dec 10, 2009 1:07 pm

Re: [REQUEST] Character Status On Userpanel

Postby Circa on Thu Jan 24, 2013 5:14 am

Are you even trying to learn?

You seem to ask for a lot of help and code to be given to you.
Circa
Clown
Clown
 
Posts: 404
Joined: Sun Aug 23, 2009 5:52 am
Location: CA

Re: [REQUEST] Character Status On Userpanel

Postby rave on Thu Jan 24, 2013 11:26 am

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
rave
Clown
Clown
 
Posts: 459
Joined: Thu Dec 10, 2009 1:07 pm

Re: [REQUEST] Character Status On Userpanel

Postby observe on Thu Jan 24, 2013 4:58 pm

  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
observe
osRose dev
osRose dev
 
Posts: 194
Joined: Thu Sep 17, 2009 10:28 am
Location: The Netherlands

Re: [REQUEST] Character Status On Userpanel

Postby Circa on Thu Jan 24, 2013 5:35 pm

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.
Circa
Clown
Clown
 
Posts: 404
Joined: Sun Aug 23, 2009 5:52 am
Location: CA

Re: [REQUEST] Character Status On Userpanel

Postby observe on Thu Jan 24, 2013 8:27 pm

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
observe
osRose dev
osRose dev
 
Posts: 194
Joined: Thu Sep 17, 2009 10:28 am
Location: The Netherlands

Re: [REQUEST] Character Status On Userpanel

Postby rave on Fri Jan 25, 2013 1:22 am

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
rave
Clown
Clown
 
Posts: 459
Joined: Thu Dec 10, 2009 1:07 pm

Re: [REQUEST] Character Status On Userpanel

Postby observe on Fri Jan 25, 2013 1:46 am

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
observe
osRose dev
osRose dev
 
Posts: 194
Joined: Thu Sep 17, 2009 10:28 am
Location: The Netherlands

Re: [REQUEST] Character Status On Userpanel

Postby rave on Fri Jan 25, 2013 7:03 am

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
rave
Clown
Clown
 
Posts: 459
Joined: Thu Dec 10, 2009 1:07 pm

Re: [REQUEST] Character Status On Userpanel

Postby observe on Fri Jan 25, 2013 7:37 am

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
observe
osRose dev
osRose dev
 
Posts: 194
Joined: Thu Sep 17, 2009 10:28 am
Location: The Netherlands

Next

Return to PHP / Web Guides, Scripts and tools.

Who is online

Users browsing this forum: No registered users and 7 guests

cron