Have you executed this query in the mysql client or phpmyadmin
Have you executed this query in the mysql client or phpmyadmin
I agree perfectly with pritaeas. I will advice you to go and learn the basis of php and programming. But since you are a beginner, I thought of refreshing myself with your problem. I have commented it very well for you to understand. Try it and I hope it solved your problem.
<?php
//this is the set of numbers
$numbers = 1432;
//getting the number of characters(length) of the set of numbers
$num_length = strlen($numbers);
//Will be using substr so setting the offset to zero
$i = 0;
//intialising the sum variable.
$sum = 0;
//executing the loop
while ($i < $num_length) {
//adding up numbers till the last one
$sum += substr($numbers, $i, 1);
//incrementing $i(offset) each time the a number is added
$i++;
}
//outputting the total results.
echo $sum;
?>
I don't get what you are trying to express. Your first script has no relation to the second one. Can you express yourself vividly?
Then Fetching is your friend