Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> zapytanie sql w funkcji
ColdFire
post 14.04.2006, 13:17:16
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 24.10.2004

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


Mam taką funkcję:
  1. <?php
  2.  
  3. function settings($var)
  4. {
  5. $query = "SELECT * FROM `". $db_prefix ."_settings` WHERE var='".$var."'";
  6. $result = mysql_query($query);
  7. while ($row = mysql_fetch_assoc($result))
  8. {
  9. return $row[value];
  10. }
  11. }
  12.  
  13. ?>

którą wywołuję w indexie tak: settings('sitetheme');
co powoduje wyświetlenie błędu
Cytat
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in ...  on line 100

struktura tabeli:
Kod
id  var  value
(..)          (...)        (...)
3            sitetheme nowy

co robię źle? bo wygląda mi na to, że w funkcjach nie da się wykonywać zapytań, w co średnio chce mi się wierzyć....

Ten post edytował ColdFire 14.04.2006, 13:18:02
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 00:45