Wysłany: 2014-05-18, 00:03
Porucznik
Wiek: 30 Na forum: 5010 dni Posty: 33
Nick w MP: Porucznik
Piwa : 1
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?
Wysłany: 2014-05-18, 09:48
Combacior
Wiek: 29 Na forum: 5796 dni Posty: 1516
Piwa : 2161
Z?a kolejno??, powinno by?:
Kod: mysql_query(...);
mysql_store_result();
myqsl_fetch_row(...);
Funkcja mysql_store_result potrzebna tylko podczas zapyta? typu SELECT
Wysłany: 2014-05-18, 12:39
Porucznik
Wiek: 30 Na forum: 5010 dni Posty: 33
Nick w MP: Porucznik
Piwa : 1
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?
Wysłany: 2014-05-18, 18:04
Axel9697
Wiek: 32 Na forum: 5904 dni Posty: 115
Piwa : 44
Kod:
Musisz zwr?ci? dan? z bazy danych, a nie sta?o ustawion? jedynk?.
Tagi: złe :: pobieranie :: danych :: liczbowych :: mysql
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: