What Command i should use that MSSQL Displays only in table in column 'WorldIDX' Bloody Ice
What Command i should use that MSSQL Displays only in table in column 'WorldIDX' Bloody Ice
;)Code:select [name],lev,worldidx from dbo.cabal_character_table where worldidx=1 and login=1
no-no .. i mean if WorldIDX is 1 that in Table is writed by "Bloody Ice"
if WorldIDX is 2 that in Table is writed by "Desert"
if WorldIDX is 3 that in Table is writed by "Green Despair"
many curses about that... does it really bother you?
Yes .. i want to dipslay the chars Information "Who is online?" (Name , LVL and WorldIDX (Not numbers ) in index.php of Chumpy's Reg page
Oh i see, sorry. The map names are not held in the database so you can't do it from a query. You could add a table to the database with the map numbers and then use a join to join the name table onto it but that is the hard way. It would be best to use an array in PHP.
First make the array of map names:
You can add the rest of the map names, just follow that format (map number => map name, you can skip numbers like map 11 and 12). Now run your query and get the user's name and map number so you can read the array for the name:Code:$maps_array=array(1=>'Bloody Ice',2=>'Desert Scream',3=>'Green Despair');
That will read the maps_array entry for the map number and get the map name.Code:$r=mssql_query("select * from select [name],lev,worldidx from dbo.cabal_character_table where and login=1"); $row=mssql_fetch_row($r); echo 'Name: '.$row[0].'<br />'; echo 'Level: '.$row[1].'<br />'; echo 'Map: '.$maps_array[$row[2]].'<br />';
Big Thanks ... and what command i should use that (Now online chars : "Mssql Query of Info" ) ?
ADDED
And there are your query has error for PHP (If using the chumpy's reg page)
Needed:$r=mssql_query("select * from select [name],lev,worldidx from dbo.cabal_character_table where and login=1");
i not sure$r=mssql_query("select * from select [name],lev,worldidx from '.DB_GAM.'.dbo.cabal_character_table where and login=1");
Yes you will need that (different quotes though). Your original query didn't have it so i left it out too.Code:$r=mssql_query("select * from select [name],lev,worldidx from ".DB_GAM.".dbo.cabal_character_table where and login=1");
To get the total of online chars use this:
Code:select count(*) from ".DB_GAM.".dbo.cabal_character_table where login=1
Maybe you should check out some of the tutorials at php.net :P
Code:$maps_array=array(1=>'Bloody Ice',2=>'Desert Scream',3=>'Green Despair'); $r=mssql_query("select * from select [name],lev,worldidx from dbo.cabal_character_table where and login=1"); for ($i=1;$i<=mssql_num_rows($r);$i++) { $row=mssql_fetch_row($r); echo 'Name: '.$row[0].'<br />'; echo 'Level: '.$row[1].'<br />'; echo 'Map: '.$maps_array[$row[2]].'<br />'; mssql_next_result($r); }