Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobieranie danych ze słownika
Largo
post
Post #1





Grupa: Zarejestrowani
Postów: 203
Pomógł: 6
Dołączył: 11.09.2005

Ostrzeżenie: (0%)
-----


Witam,

Mam pewien problem związany ze słownikiem w bazie danych. Problem polega na tym, że muszę dodać ikonkę obok nazwy użytkownika zależną od ilości wpłaconych realnych pieniędzy. Sprawa wygląda tak - mam tabelę fg_transactions i tam jest pole price ( cena/kwota ) i po jego ilości mam sprawdzać czy w słowniku ( tabela donate_images ) znajduje się przedział dla tej kwoty. Oto przedziały:

0.00 - 9.99
10.00 - 29.99
30.00 - 49.99
50.00 - 99.00
100.00 - 199.99
200.00 - 449.99
500+

I jeżeli znajduje się w przedziale, to ustawianie ikonki sam zrobię Jak zapytanie ogarnąć? JOIN nie wchodzi w grę, nie ma klucza... Czy w tabeli użytkowników dodać pole np. donate_amount i podczas transakcji SMS inkrementować to pole? Jak Wy to widzicie? Chodzi o problem, nie o gotowy kod :-) Zapytanie, mniej więcej miałej wizję:

  1. SELECT img_url AS donate_icon FROM ibf_members WHERE ( sposób ) BETWEEN min_range AND max_range


min i max to wiadomo zakresy podane powyżej.

Pozdrawiam,
Largo
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Largo
post
Post #2





Grupa: Zarejestrowani
Postów: 203
Pomógł: 6
Dołączył: 11.09.2005

Ostrzeżenie: (0%)
-----


Witaj,

Tabela members:

  1. CREATE TABLE ibf_members (
  2. id mediumint(8) NOT NULL DEFAULT '0',
  3. name varchar(255) NOT NULL DEFAULT '',
  4. mgroup smallint(3) NOT NULL DEFAULT '0',
  5. email varchar(150) NOT NULL DEFAULT '',
  6. joined int(10) NOT NULL DEFAULT '0',
  7. ip_address varchar(16) NOT NULL DEFAULT '',
  8. posts mediumint(7) DEFAULT '0',
  9. title varchar(64) DEFAULT NULL,
  10. allow_admin_mails tinyint(1) DEFAULT NULL,
  11. time_offset varchar(10) DEFAULT NULL,
  12. hide_email varchar(8) DEFAULT NULL,
  13. email_pm tinyint(1) DEFAULT '1',
  14. email_full tinyint(1) DEFAULT NULL,
  15. skin smallint(5) DEFAULT NULL,
  16. warn_level int(10) DEFAULT NULL,
  17. warn_lastwarn int(10) NOT NULL DEFAULT '0',
  18. LANGUAGE varchar(32) DEFAULT NULL,
  19. last_post int(10) DEFAULT NULL,
  20. restrict_post varchar(100) NOT NULL DEFAULT '0',
  21. view_sigs tinyint(1) DEFAULT '1',
  22. view_img tinyint(1) DEFAULT '1',
  23. view_avs tinyint(1) DEFAULT '1',
  24. view_pop tinyint(1) DEFAULT '1',
  25. bday_day int(2) DEFAULT NULL,
  26. bday_month int(2) DEFAULT NULL,
  27. bday_year int(4) DEFAULT NULL,
  28. new_msg tinyint(2) DEFAULT '0',
  29. msg_total smallint(5) DEFAULT '0',
  30. show_popup tinyint(1) DEFAULT '0',
  31. misc varchar(128) DEFAULT NULL,
  32. last_visit int(10) DEFAULT '0',
  33. last_activity int(10) DEFAULT '0',
  34. dst_in_use tinyint(1) DEFAULT '0',
  35. view_prefs varchar(64) DEFAULT '-1&-1',
  36. coppa_user tinyint(1) DEFAULT '0',
  37. mod_posts varchar(100) NOT NULL DEFAULT '0',
  38. auto_track varchar(50) DEFAULT '0',
  39. temp_ban varchar(100) DEFAULT '0',
  40. sub_end int(10) NOT NULL DEFAULT '0',
  41. login_anonymous char(3) NOT NULL DEFAULT '0&0',
  42. ignored_users text NULL,
  43. mgroup_others varchar(255) NOT NULL DEFAULT '',
  44. org_perm_id varchar(255) NOT NULL DEFAULT '',
  45. member_login_key varchar(32) NOT NULL DEFAULT '',
  46. member_login_key_expire INT(10) NOT NULL DEFAULT '0',
  47. subs_pkg_chosen smallint(3) NOT NULL DEFAULT '0',
  48. has_blog tinyint(1) NOT NULL DEFAULT '0',
  49. has_gallery tinyint(1) NOT NULL DEFAULT '0',
  50. members_markers text NULL,
  51. members_editor_choice char(3) NOT NULL DEFAULT 'std',
  52. members_auto_dst tinyint(1) NOT NULL DEFAULT '1',
  53. members_display_name varchar(255) NOT NULL DEFAULT '',
  54. members_created_remote tinyint(1) NOT NULL DEFAULT '0',
  55. members_cache MEDIUMTEXT NULL,
  56. members_disable_pm INT(1) NOT NULL DEFAULT '0',
  57. members_l_display_name VARCHAR(255) NOT NULL DEFAULT '0',
  58. members_l_username VARCHAR(255) NOT NULL DEFAULT '0',
  59. failed_logins TEXT NULL,
  60. failed_login_count SMALLINT(3) DEFAULT '0' NOT NULL,
  61. members_profile_views INT(10) UNSIGNED NOT NULL DEFAULT '0',
  62. )


Tutaj dodaję 2 pola.

Tabela donate_images ( słownik ):

  1. CREATE TABLE ibf_donate_images (
  2. image_url varchar( 255 ) NOT NULL,
  3. min_range decimal( 4, 2 ) NOT NULL DEFAULT '0.00',
  4. max_range decimal( 4, 2 ) NOT NULL DEFAULT '0.00',
  5. )
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 01:59