I need to check if number in database is 1 or 0, and which number it is from beggining, for example, in my SQL column I have information like this:
0 0 0 1 0
And it has number 1 in it's SQL, and it's the fourth number from beginning, and I need to loop through all variables and check where is and what is this number, code something like this:
for($i = 0; $<5; $i++) {
while(//what to do here?) {
//Code
}
}
And, more examples:
if($Array[$i] == 1) { //Checks if the number is 1
echo "The number 1 in your column is at position:". $Variable .";
Shows where is the number from the beggining, in this case it is 4. So, thanks for help, sorry for my bad english.
Well, I readed your comments, and tried to do this myself, and I did, here is how I done this:
else {
$arr = explode(" ", $row["skins"]);
for($a = 0; $a < count($arr); $a++) {
if($arr[$a] == 1) {
//Rest of the code
}
}
}
It's not full code, but it works. Thanks for your support, and your motivation that I can do it myself :)