1
Hi, I’m creating a fb BOT and I need help, I need that together with the while of the database I need a for that goes from 1 to the last record. So the user can send the code corresponding to the registration!
}elseif($text == "BONUS"){
$id_cl = $resexiste->id;
$existebonus = BD::conn()->prepare("SELECT * FROM `bonus_attr` WHERE user_id = ? AND usado = ? ORDER by bonus_id desc");
$existebonus->execute(array($id_cl, "0"));
if($existebonus->rowCount() == 0){
enviaMSG($sender, "Não ha nenhum bonus atribuido a esta conta!");
}else{
enviaMSG($sender, "Envia o codigo correspondente ao bónus que queres usar:");
while($reseb = $existebonus->fetchObject()){
$titulo = $reseb->bonus_title;
enviaMSG($sender, $titulo);
}
}
}else{
enviaMSG($sender, "Syntax Invalida!");
}
Where exactly the
for
would enter there in this code? And the function ofwhile
isn’t just going through all the records? If yes, what would be the function of thefor
?– Woss
I create the for this: 1 - Title 1; 2 - Title2; but the titles come from the database; the numbering create that came from the for
– The Coder
And what the
while
is currently doing?– Woss
Currently as this in the above code posted, it is to list all titles but without numbering
– The Coder
So what you need is not a
for
, but only one counter for the securities?– Woss
yes, and how could I do that?
– The Coder