mysql - Variable changes in PHP -
i need keep variable in long form, don't understand these changes.
my code:
//db connection $sql = "select * `slevy` 1 "; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $sleva = $row['sleva']; echo $sleva; } echo "------------".$sleva;
output is:
99381585659209563465667261720583722336659395405------------659395405
in body of cycle save $sleva
, echo
sales, after while
cycle $sleva
contains last 1 row database.
while ($row = $result->fetch_assoc()) { $sleva = $row['sleva']; echo $sleva . '<br>'; } // output like: 993815856<br> 592095634<br> 656672617<br> 205837223<br> 659395405<br>
you wrote to keep variable in long form
. means, probably, save $sleva
variable whole string, concatenate sales.
$sleva = ''; while ($row = $result->fetch_assoc()) { $sleva .= $row['sleva']; } echo $sleva; // output: 99381585659209563465667261720583722336659395405
Comments
Post a Comment