![]() |
|
Some problems to get characters - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196) +---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192) +---- Thread: Some problems to get characters (/showthread.php?tid=2293) |
- ReturnKratos - 08-09-2013 im creating a reborn system, ive just one problem with get chars from db. here my code : $cong = mysql_connect( $Server["server"] , $Server["user"] , $Server["pass"] ) or die( mysql_error() ); mysql_select_db( $db_char , $cong) or die(mysql_error()); $stringg = "SELECT * FROM `t_characters` WHERE `a_user_index` = ".$_SESSION[user_code]." AND a_enable = 1 ORDER BY a_level desc LIMIT ".$CharacterNumMax.""; $queryg = mysql_query($stringg, $cong) or die(mysql_error()); while ($row = mysql_fetch_array($queryg)) { $CharID_1 = $row[a_index]; $CharName_1 = $row[a_name]; $CharLevel_1 = $row[a_level]; $CharReborn_1 = $row[a_reborn]; } But with this code i get just the last character. some one can help me ? i need get all character where a_user_index = $_SESSION[user_code] AND a_enable = 1 Edit : Ive fixed myself lol here the fix : while ($row = mysql_fetch_array($queryg)) { if ($Count != $CharacterNumMax) { $Count = $Count + 1; $CharCount = $Count; $CharID[$CharCount] = $row[a_index]; $CharName[$CharCount] = $row[a_name]; $CharLevel[$CharCount] = $row[a_level]; $CharReborn[$CharCount] = $row[a_reborn]; } else { } } - someone - 08-09-2013 I suggest using DBO or MySqli(with mysqli you can use it the same as mysql, just the functions are called mysqli_ instead of mysql_), because its deprecated, and in newer PHP versions will have problems(will be removed in newer versions). - Johnny5 - 08-20-2013 Topic Closed by a moderator. The reason why: Solved |