Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] [mysql] Wyświetlanie zawarości bazy danych
gala
post
Post #1





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 3.07.2007

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


Proszę pomóżcie!
Przy przetwarzaniu kodu:
  1. <?PHP 
  2.  if (isset($_GET['id_strony']))
  3. @$id_strony = $_GET['id_strony'];
  4.  else $id_strony = 1; // jeśli nie wysłano takiej zmiennej – wczytaj index
  5. $query = 'SELECT tresc FROM strony where id_strony='.$id_strony.';';
  6.  $wynik = $db_query($query);
  7.  $rekord = mysqli_fetch_assoc($wynik);
  8.  echo '<p>'.$rekord['tresc'].'</p>';
  9. $db->disconnect();
  10. ?>

wyświetla mi sie komunikat:Fatal error: Function name must be a string in /inc/index.php on line 6
Co jest źle?

Ten post edytował gala 3.04.2008, 12:32:46
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
gala
post
Post #2





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 3.07.2007

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


Taki jest oryginalny, niezmieniony kod z ćwiczenia:
  1. <?PHP 
  2. if (isset($_GET['id_strony']))
  3. @$id_strony = $_GET['id_strony'];
  4.  else $id_strony = 1; // jeśli nie wysłano takiej zmiennej – wczytaj index
  5. $query = 'SELECT tresc FROM strony where id_strony='.$id_strony.';';
  6.  $wynik = mysqli_query($query);
  7.  $rekord = mysqli_fetch_assoc($wynik);
  8.  echo '<p>'.$rekord['tresc'].'</p>';
  9. mysql_close($conn);
  10. ?>

Po wyświetleniu go , dzieje się to:
Warning: mysqli_query() expects at least 2 parameters, 1 given in /inc/index.php on line 7
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /inc/index.php on line 8
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /inc/index.php on line 11
W 11 lini nie ma kodu.
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: 26.09.2025 - 10:17