Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL][PHP]<title> w mysql
Forum PHP.pl > Forum > Przedszkole
Marcinekk
Siema, tworzę skrypt, dzięki któremu treść w <title> będzie pobierana z mysql`a.

Lecz mam taki problem :

Kod
Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /usr/home/marcin1465/domains/marcinek-yt.ct8.pl/public_html/header.php on line 8 Warning: mysql_query(): A link to the server could not be established in /usr/home/marcin1465/domains/marcinek-yt.ct8.pl/public_html/header.php on line 8 Warning: mysql_fetch_row() expects parameter 1 to be resource, null given in /usr/home/marcin1465/domains/marcinek-yt.ct8.pl/public_html/header.php on line 9


Kod :

  1. <?php
  2.  
  3. <html>
  4. <head>
  5. ';
  6.  
  7. $resultt = mysql_query("SELECT Count(id) FROM `head`");
  8. $rowe = mysql_fetch_row($result);
  9. $count_userss = $row[0];
  10.  
  11. if($count_userss > 0) {
  12. $result = mysql_query("SELECT * FROM `head` ORDER BY `id`");
  13. while($rowe = mysql_fetch_assoc($resultt)) {
  14.  
  15. echo '
  16.  
  17. <title>'.$row['tresc'].'</title>
  18. ';
  19.  
  20.  
  21.  
  22. }
  23. }else{
  24. // jeśli nie ma w ogóle to wyświetlamy komunikat
  25. echo '<title>None</title>';
  26. }
  27. <link href="css/style.css" rel="stylesheet" type="text/css" />
  28. </head>
  29. <body>';
  30.  
  31.  
  32.  
  33. ?>


Linia 8
  1. $resultt = mysql_query("SELECT Count(id) FROM `head`");


Linia 9

  1. $rowe = mysql_fetch_row($result);


Dodam jeszcze, że jak zaincluduje config to wywala kolejne błędy..

Proszę o pomoc, ponieważ na tej samej zasadzie zrobiłem stopke i normalnie działa, a tutaj nic.
viking
Ale widzisz przecież że problem jest z użytkownikiem a raczej jego brakiem. Najpierw nawiąż połączenie.
Gość
linia 8.
$resultt

linia 9.
$result
Marcinekk
Dobra, errora już nie ma, ale w ogóle nie pobiera danych do <title> jest cały czas None.

@edit już działa, dziękuje wszystkim za pomoc.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.