Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-05-18, 00:03


Porucznik







Wiek: 30
Na forum: 5010 dni
Posty: 33
Nick w MP: Porucznik

Piwa: 1

Respekt: 50

Dlaczego ta funkcja:
Kod:

GetPlayerExp(playerid){
new SEXP[127];
format(SEXP, sizeof(SEXP), "SELECT `Exp` FROM `Gracze` WHERE `Nick` = '%s'", PlayerName(playerid));
mysql_store_result();
mysql_fetch_row(SEXP);
mysql_query(SEXP);
return 1;
}


powoduje takie b??dy?

Cytat:

[23] [MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed.
[23] [MySQL] Error (0): Function: mysql_store_result called when no result stored.
[23] [MySQL] Error (0): Failed to exeute query. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Function: mysql_num_rows called when no result stored. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Failed to exeute query. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Function: mysql_num_rows called when no result stored. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Failed to exeute query. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Failed to exeute query. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Function: mysql_fetch_int called when no result stored. Commands out of sync; you can't run this command now.
[23] [MySQL] Error (0): Failed to exeute query. Commands out of sync; you can't run this command now.


Tak samo dzieje si? z i bez mysql_fetch_row(SEXP);
Co zrobi?, ?eby poprawnie si? pobiera?y dane?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-18, 09:48


Combacior







Wiek: 29
Na forum: 5796 dni
Posty: 1516

Piwa: 2161

Respekt: 1060
Respekt: 1060

Ostrzeżeń: 20%
Z?a kolejno??, powinno by?:

Kod:

mysql_query(...);
mysql_store_result();
myqsl_fetch_row(...);


Funkcja mysql_store_result potrzebna tylko podczas zapyta? typu SELECT

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-18, 12:39


Porucznik







Wiek: 30
Na forum: 5010 dni
Posty: 33
Nick w MP: Porucznik

Piwa: 1

Respekt: 50

Mam zatem taki kod:

Kod:

GetPlayerExp(playerid){
new SEXP[127];
format(SEXP, sizeof(SEXP), "SELECT `Exp` FROM `Gracze` WHERE `Nick` = '%s'", PlayerName(playerid));
mysql_query(SEXP);
mysql_store_result();
mysql_fetch_row(SEXP);
return 1;
}


lecz dlaczego zwraca on zawsze 1? Nie pobiera z bazy danych nic tylko 1, kt?rego nie ma. Dlaczego?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-18, 18:04


Axel9697







Wiek: 32
Na forum: 5904 dni
Posty: 115

Piwa: 44

Respekt: 73,2

Kod:

return 1;

Musisz zwr?ci? dan? z bazy danych, a nie sta?o ustawion? jedynk?. :->

Postaw piwo autorowi tego posta
 

 
Tagi: złe :: pobieranie :: danych :: liczbowych :: mysql
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku