Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] dziwny blad...
suck
post 10.06.2006, 22:27:06
Post #1





Grupa: Zarejestrowani
Postów: 43
Pomógł: 0
Dołączył: 7.03.2006

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


  1. <?php
  2. require('conf.php');
  3. $conn=mysql_connect($host, $user, $pass);
  4. $query="select count(*) from studenci where studenci.id='" .$_POST['login']
  5. ."' and studenci.haslo='" .md5($_POST['pass']) ."'";
  6. echo $query;
  7. $wynik=mysql_query($query);
  8. echo mysql_result($query,0, 0);
  9. ?>


i dostaje
  1. select count(*) from studenci where studenci.id='1' and studenci.haslo='81dc9bdb52d04dc20036dbd8313ed055'
  2. Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\usr\krasnal\www\zaliczenie\sprawdzenie.php on line 9


nie mam pojecia co jest nie tak :/

Ten post edytował suck 10.06.2006, 22:27:44
Go to the top of the page
+Quote Post
mike
post 10.06.2006, 22:48:08
Post #2





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Proponuje doczytać jakie argumenty przyjmuje funkcja mysql_result()
Na pewno nie podaje jej się zapytaia jako stringa w pierwszym parametrze tongue.gif
Go to the top of the page
+Quote Post
TomASS
post 10.06.2006, 22:52:24
Post #3





Grupa: Zarejestrowani
Postów: 1 660
Pomógł: 13
Dołączył: 9.06.2004
Skąd: Wrocław i okolice

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


Łeeee.... taki błąd to nie błąd smile.gif
Dajesz:
  1. <?php
  2. echo $query;
  3. ?>

to i wyświetla Ci zapytanie.
Pewnie chciałeś coś takiego:

  1. <?php
  2. require('conf.php');
  3. $conn=mysql_connect($host, $user, $pass);
  4. $query="select count(*) from studenci where studenci.id='" .$_POST['login'] ."' and studenci.haslo='" .md5($_POST['pass']) ."'";
  5. $result = mysql_query($query);
  6. while ($row = mysql_fetch_array($result)){
  7. print_r($row);
  8. }
  9. ?>


--------------------
Go to the top of the page
+Quote Post
suck
post 10.06.2006, 23:10:09
Post #4





Grupa: Zarejestrowani
Postów: 43
Pomógł: 0
Dołączył: 7.03.2006

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


rada mike_mech dala rozwiazanie tzn trza bylo zrobic:

  1. <?php
  2. mysql_result($wynik,0,0)
  3. ?>


dzieki all smile.gif
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: 20.06.2025 - 22:09