Autor Zpráva
terminátor
Profil *
Ahoj, mám web u endory a ujedný funkce konrétně barvení textu, mi to píše chybu:
Warning: mysql_result() expects parameter 2 to be long, string given in ........... on line 24

řádek 24:
$typ_result = mysql_result($typ_query,"stav");
panther
Profil
terminátor:
ano, máš chybu v dotazu. Nic divného to není.
terminátor
Profil *
mimochodem u free hostingu a n1ce.cz to nedělá
terminátor
Profil *
    $typ_query = mysql_query("SELECT stav FROM report WHERE id = ".$row['id']." ");
    $typ_result = mysql_result($typ_query,"stav");
    
    
    
   if($typ_result == "1") { echo "<span class=\"ok\">Aktivní</span>"; } else { echo "<span class=\"lose\">Neaktivní</span>"; } 
    
    


co je natomhle špatně?
denCo
Profil
string mysql_result ( resource $result , int $row [, mixed $field = 0 ] )

možno v zlom druhom parametri

terminátor:
mimochodem u free hostingu a n1ce.cz to nedělá
hej? to sa mi ani veriť nechce
panther
Profil
terminátor:
vypiš si mysql_error(), uvidíš.
Davex
Profil
denCo:
„mimochodem u free hostingu a n1ce.cz to nedělá“
hej? to sa mi ani veriť nechce
V konfiguraci PHP tam může být vypnuto zobrazování varování.

Jinak se domnívám, že máš pravdu a že to bude tím.
terminátor
Profil *
denCo:
string mysql_result ( resource $result , int $row [, mixed $field = 0 ] )

tohle je co?
panther
Profil
terminátor:
z Manuálu, co má ta funkce obsahovat.
terminátor
Profil *
a jak to správně zapíšu, když tam potřebuju ten "stav"?
     $typ_result = mysql_result($typ_query);
panther
Profil
terminátor:
http://cz.php.net/function.mysql_result
druhý parametr, který je očekáván, je integer.
terminátor
Profil *
můžete mi prosím někdo napsat jak to má bejt?
aď zkouším co zkouším pořád mi to nejde

 $typ_result = mysql_result($typ_query , int "stav");
           $typ_result = mysql_result($typ_query , int "$typ_result");

nefunguje mi
Davex
Profil
Druhý parametr musí být celé číslo. int "stav" není číslo. Čísla jsou třeba 0, 15 nebo 5193730.
terminátor
Profil *
Davex:
díky funguje :)

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0