Ho questo codice:
Codice PHP:
$step1 = 0;
$step2 = 100;
$stp1 = $_POST["start"];
$stp2 = $_POST["end"];
if ($stp1 !== "") {
$step1 = $stp1;
} else if ($stp1 == "") {
$step1 = $step1;
}
if ($stp2 !== "") {
$step2 = $stp2;
} else if ($stp2 == "") {
$step2 = $step2;
}
$result = mysql_query("SELECT * FROM `test` DESC LIMIT '$step1','$step2'");
while ($row = mysql_fetch_array($result)) {
// qui va la funzione da eseguire
$step1 = $step1+100;
$step2 = $step2+100;
}
In pratica, nelle intenzioni vorrei poter selezionare, di volta in volta, gruppi di 100 dati, su cui eseguire la funzione.
Ogni volta, ripasso i valori incrementati alla pagina, attraverso un form.
Il problema è che mi dà il solito messaggio di warning:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
, relativamente alla riga:
Codice PHP:
$result = mysql_query("SELECT * FROM `test` DESC LIMIT '$step1','$step2'")
Chiaro che non mi accetta le variabili $step1 e $step2 come valori.
Allora, come posso fare a risolvere questo problema?