Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server
You last visited: Today at 04:08

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Someone could help me out?

Discussion on Someone could help me out? within the Shaiya Private Server forum part of the Shaiya category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2009
Posts: 13
Received Thanks: 4
Someone could help me out?

Hello all.I got some problems with this query
PHP Code:
<?php 

$sql_server 
"localhost";
$sql_user "user"
$sql_pass "pass"
$sql_data "PS_GameData"
$conn=mssql_connect($sql_server,$sql_user,$sql_pass);
$xadb mssql_select_db($sql_data,$conn); 
  
echo 
"<center><br><br>"
echo 
"<table border='1'> 
    <tr> 
        <td align='center'>Character Name</td> 
        <td align='center'>Level</td> 
        <td align='center'>Map</td> 
        <td align='center'>Rank</td> 

    </tr>"


$name1 mssql_query("select [CharName],[Level],[Map],[k1] from [dbo].[Chars] where LoginStatus = 1"); 
$row1 mssql_fetch_row($name1);
echo 
"<tr> 

            <td align='left'>"
.$row1[0]."</td> 
            <td align='center'>"
.$row1[1]."</td> 
            <td align='center'>"
.$row1[2]."</td> 
            <td align='center'>"
.$row1[3]."</td>     

        </tr>"


mssql_close($conn);
?>
It showing only 1 player when there are more online.Any tips on how to fix it to show all players online will be much appreciated!
darkmanx1986 is offline  
Old 07/12/2011, 06:31   #2
 
RebeccaBlack's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
PHP Code:
<?php 
$sql_server 
"localhost";
$sql_user "user"
$sql_pass "pass"
$sql_data "PS_GameData"
$conn=mssql_connect($sql_server,$sql_user,$sql_pass);
mssql_select_db($sql_data,$conn);

$query mssql_query("select * from [Chars] where LoginStatus = 1"); 
if(
mssql_num_rows($query)){
echo 
"<center><br><br>"
echo 
"<table border='1'> 
    <tr> 
        <th align='center'>Character Name</th> 
        <th align='center'>Level</th> 
        <th align='center'>Map</th> 
        <th align='center'>Rank</th> 

    </tr>"

while(
$row mssql_fetch_array($query)){
echo 
"<tr>";
echo 
"<td align='left'>".$row1['CharName']."</td>";
echo 
"<td align='center'>".$row1['Level']."</td>";
echo 
"<td align='center'>".$row1['Map']."</td>";
echo 
"<td align='center'>".$row1['K1']."</td>";    
echo 
"</tr>"
}
echo 
"</center></table>";
}else{echo 
"No one is online at this moment!";}
mssql_close($conn);
?>
Didn't test it, just rewrote it in a quote back to you. Am not really a PHP expert but it should work fine, you just needed a while loop on the mssql_fetch_array, so it'd pull back more data than 1 person.

*Edit* Rewrote it again, noticed unclosed tags, and I reordered the operations.
RebeccaBlack is offline  
Thanks
4 Users
Reply




All times are GMT +1. The time now is 04:09.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.