Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Baza danych
dino6213221
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 18.01.2011

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


Witam. Gdy chcę wykonać zapytanie sql wyświetlają mi się takie błędy:
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\PhpProject3\index.php on line 20

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\PhpProject3\index.php on line 20


Pomożecie mi się ich pozbyć?
  1. <?php
  2. ?>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  7. <title>Logowanie</title>
  8. </head>
  9. <body bgcolor="teal">
  10. <div style="font-family:Courier; font-size: xx-large; text-align: center">
  11. <b><u>
  12. Logowanie do bazy danych
  13. <br><br />
  14.  
  15. <form action="logowanie.php" method="post">
  16. <fieldset>
  17. <div style="text-align: center">
  18. <legend> Proszę wpisać dane</legend>
  19. </div>
  20. <fieldset />
  21. <input type="text" name="login" maxlength="10" size="20">-login<br />
  22. <input type="text" name="haslo" maxlength="10" size="20">-hasło<br />
  23. <input type="submit" name="wyslij" value="Wyślij">
  24.  
  25. </form>
  26.  
  27.  
  28.  
  29. <?php
  30. $host='localhost';
  31. $baza='projekt';
  32. if(isset($_POST['login'])&& isset($_POST['haslo']))
  33. {
  34. $login=$_POST['login'];
  35. $haslo=$_POST['haslo'];
  36. if(!empty($login) && !empty($haslo)){
  37. $sql_haslo=$haslo;
  38. $sql_login=$login;
  39. }
  40. }
  41. if(isset($_POST['wyslij'])){
  42. $polaczenie=@mysql_connect($host,$sql_login,$sql_haslo)
  43. or die('zle dane');
  44. header('Location: index.php');
  45. }
  46.  
  47. ?>
  48. </div>
  49. </body>
  50. </html>


  1. <html>
  2. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3. <title>Baza danych</title>
  4. <body>
  5. <div style="text-align: center">
  6. <form action="index.php" method="post">
  7. <input type="submit" name="wyswietl" value="Wyświetl wszystkich kandydatów"><br />
  8. </form>
  9. <form action="index.php" method="post">
  10. <input type="submit" name="szukaj" value="Szukaj kandydata"><br />
  11. </form>
  12. </div>
  13. </body>
  14. </html>
  15. <?php
  16.  
  17. if(isset($_POST['wyswietl']))
  18. {
  19. $sql='select * from kandydaci';
  20. $wyswietl=mysql_query($sql) or die('Błąd bazy');
  21. $wynik=mysql_fetch_array($wyswietl);
  22. echo $wynik;
  23.  
  24.  
  25. }
  26. ?>
  27.  
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: 28.09.2025 - 20:17