Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Polaczenie z baza danych
kwi4tusz3k
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 7.11.2012

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


Witam, nie moge polaczyc sie ze swoja baza danych i wyswietlic rekordow. Po zaladowaniu storny wyskakuje mi:
Iloœć osob w bazie danych: ".$num_results."
"; for ($i=0; $i <$num_results; $i++) { $row = mysql_fetch_array($result); print ($i+1).". imie:"; print stripslashes($row["imie"]); print ", nazwisko: "; print stripslashes($row["nazwisko"]); print "data urodzenia:"; print stripslashes($row["data urodzenia"]); print "
"; } ?>

Kod
  1. <?
  2. @$db = mysql_pconnect("localhost", "root", "");
  3. if (!$db)
  4. {
  5. print "wystąpił błąd w połączeniu";
  6. exit;
  7. }
  8.  
  9. mysql_select_db("bierzmowani");
  10.  
  11.  
  12.  
  13. $query = "select * from bierzmowani";
  14. $result = mysql_query($query);
  15. $num_results = mysql_num_rows($result);
  16.  
  17. print "<p>Ilość osob w bazie danych: ".$num_results."</p>";
  18. for ($i=0; $i <$num_results; $i++) {
  19. $row = mysql_fetch_array($result);
  20. print ($i+1).". imie:";
  21. print stripslashes($row["imie"]);
  22. print ", nazwisko: ";
  23. print stripslashes($row["nazwisko"]);
  24. print "data urodzenia:";
  25. print stripslashes($row["data urodzenia"]);
  26. print "<br>";
  27. }
  28. ?>


Co moze byc nie tak?

Ten post edytował kwi4tusz3k 7.11.2012, 15:22:08
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kwi4tusz3k
post
Post #2





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 7.11.2012

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


juz sie mi cos ruszylo zmienilem troche sposob laczenia sie z baza ale po tym twoim wyswietleniu kalafior wyskakuje:
Parse error: syntax error, unexpected '"', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\wamp\www\baza danych\baza2.php on line
linia 20:
echo "$MFA["imie"]";

Ten post edytował kwi4tusz3k 8.11.2012, 09:23:08
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: 16.09.2025 - 04:40