I am trying to crosscheck a column in a table with 30 rows.
Example:
$value = "a";
$sql = "select * from characters";
$query = mysql_query($sql);
$fetch = mysql_fetch_array($query);
for ($i = 0; $i < 30; $i++) {
if($value == $fetch['letters']) {
$counter++;
}
}
echo $counter;
The logic to my knowledge is the select statement is done on table characters and then a fetch array is processed based on that query.
Im confused now I cant think of the logic on how to check 30 repeated rows each time.
If statement checks if there is the same value of 'a' in both the variable and the cell if so, counter is increased by 1. Finally the counter variable is echoed out.
I am stuck at the for loop logic, please help.
Thankyou, Regards X