Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]<title> w mysql
Marcinekk
post 7.06.2014, 02:08:34
Post #1





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 27.09.2013

Ostrzeżenie: (10%)
X----


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.
Go to the top of the page
+Quote Post
viking
post 7.06.2014, 05:53:47
Post #2





Grupa: Zarejestrowani
Postów: 6 377
Pomógł: 1116
Dołączył: 30.08.2006

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


Ale widzisz przecież że problem jest z użytkownikiem a raczej jego brakiem. Najpierw nawiąż połączenie.


--------------------
Go to the top of the page
+Quote Post
-Gość-
post 7.06.2014, 10:42:16
Post #3





Goście







linia 8.
$resultt

linia 9.
$result
Go to the top of the page
+Quote Post
Marcinekk
post 7.06.2014, 13:36:41
Post #4





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 27.09.2013

Ostrzeżenie: (10%)
X----


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.

Ten post edytował Marcinekk 7.06.2014, 13:37:35
Go to the top of the page
+Quote Post

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: 3.06.2025 - 23:05