Advertisement
Guest User

Untitled

a guest
Dec 25th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. <?php
  2. include "config.php";
  3.  
  4. $data_array_json = "[";
  5.  
  6. $db = mysql_connect($db_host, $db_username, $db_password, $db_name);
  7. mysql_select_db($db_name, $db) or die (mysql_error());
  8.  
  9. $query = mysql_query("SELECT * FROM FIGHTERS_DEFAULT", $db);
  10. if(!$query) {
  11. echo "Error! ".mysql_error();
  12. exit;
  13. }else {
  14.  
  15. $index = 0;
  16. while ($row = mysql_fetch_array($query))
  17. {
  18. if ($index > 0) $data_array_json .= ",{";
  19. else $data_array_json .= "{";
  20.  
  21. $data_array_json .= ""
  22. ."\"id\": "."\"".$row['id']."\"".","
  23. ."\"character\": ["
  24. ."{"
  25. ."\"text\": "."\"".$row['DEFAULT_NAME']."\"".","
  26. ."\"width\": "."\"300\"".","
  27. ."\"height\": "."\"100\"".","
  28. ."\"size\": "."\"40\"".","
  29. ."\"color\": "."\"0xFFFFFF\"".","
  30. ."\"font\": "."\"Arial\"".","
  31. ."\"x\": "."\"10\"".","
  32. ."\"y\": "."\"0\""
  33. ."},{"
  34. ."\"text\": "."\"Уровень ".$row['DEFAULT_LEVEL']."\"".","
  35. ."\"width\": "."\"200\"".","
  36. ."\"height\": "."\"25\"".","
  37. ."\"size\": "."\"18\"".","
  38. ."\"color\": "."\"0xFFFFFF\"".","
  39. ."\"font\": "."\"Arial\"".","
  40. ."\"x\": "."\"300\"".","
  41. ."\"y\": "."\"50\""
  42. ."},{"
  43. ."\"text\": "."\"Жизнь ".$row['DEFAULT_HP']."\"".","
  44. ."\"width\": "."\"200\"".","
  45. ."\"height\": "."\"25\"".","
  46. ."\"size\": "."\"18\"".","
  47. ."\"color\": "."\"0xFFFFFF\"".","
  48. ."\"font\": "."\"Arial\"".","
  49. ."\"x\": "."\"300\"".","
  50. ."\"y\": "."\"80\""
  51. ."},{"
  52. ."\"text\": "."\"Мана ".$row['DEFAULT_MANA']."\"".","
  53. ."\"width\": "."\"200\"".","
  54. ."\"height\": "."\"25\"".","
  55. ."\"size\": "."\"18\"".","
  56. ."\"color\": "."\"0xFFFFFF\"".","
  57. ."\"font\": "."\"Arial\"".","
  58. ."\"x\": "."\"300\"".","
  59. ."\"y\": "."\"110\""
  60. ."},{"
  61. ."\"text\": "."\"Сила ".$row['DEFAULT_POWER']."\"".","
  62. ."\"width\": "."\"200\"".","
  63. ."\"height\": "."\"25\"".","
  64. ."\"size\": "."\"18\"".","
  65. ."\"color\": "."\"0xFFFFFF\"".","
  66. ."\"font\": "."\"Arial\"".","
  67. ."\"x\": "."\"300\"".","
  68. ."\"y\": "."\"140\""
  69. ."},{"
  70. ."\"text\": "."\"Защита ".$row['DEFAULT_DEFENSE']."\"".","
  71. ."\"width\": "."\"200\"".","
  72. ."\"height\": "."\"25\"".","
  73. ."\"size\": "."\"18\"".","
  74. ."\"color\": "."\"0xFFFFFF\"".","
  75. ."\"font\": "."\"Arial\"".","
  76. ."\"x\": "."\"300\"".","
  77. ."\"y\": "."\"170\""
  78. ."},{"
  79. ."\"text\": "."\"Ловкость ".$row['DEFAULT_SLEIGHT']."\"".","
  80. ."\"width\": "."\"200\"".","
  81. ."\"height\": "."\"25\"".","
  82. ."\"size\": "."\"18\"".","
  83. ."\"color\": "."\"0xFFFFFF\"".","
  84. ."\"font\": "."\"Arial\"".","
  85. ."\"x\": "."\"300\"".","
  86. ."\"y\": "."\"200\""
  87. ."},{"
  88. ."\"text\": "."\"Интеллект ".$row['DEFAULT_INTELLECT']."\"".","
  89. ."\"width\": "."\"200\"".","
  90. ."\"height\": "."\"25\"".","
  91. ."\"size\": "."\"18\"".","
  92. ."\"color\": "."\"0xFFFFFF\"".","
  93. ."\"font\": "."\"Arial\"".","
  94. ."\"x\": "."\"300\"".","
  95. ."\"y\": "."\"230\""
  96. ."},{"
  97. ."\"text\": "."\"Лидерство".$row['DEFAULT_LEADERSHIP']."\"".","
  98. ."\"width\": "."\"200\"".","
  99. ."\"height\": "."\"25\"".","
  100. ."\"size\": "."\"18\"".","
  101. ."\"color\": "."\"0xFFFFFF\"".","
  102. ."\"font\": "."\"Arial\"".","
  103. ."\"x\": "."\"300\"".","
  104. ."\"y\": "."\"260\""
  105. ."}]}";
  106.  
  107. $index++;
  108. }
  109. }
  110.  
  111. $data_array_json .= "]";
  112. echo $data_array_json;
  113.  
  114. //echo "connect goog!";
  115.  
  116. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement