MySQL PHP printf into $variable adding additional value -
i'm experiencing strange, , can't figure out why it's happening. i'm running query pull info column in mysql table, , when straight printf()
, info comes out expected. however, when $variable = printf()
, i'm getting additional value in string.
the next prints like: 22611,21435,23327,22876,22986,23692,21581,21832,22337,24313,22174,24368,
$query = "select column table year in (2012)"; if ($result = mysqli_query($connect, $query)) { while ($row = mysqli_fetch_assoc($result)) { printf ("%s,", $row["column"]); } }
but if seek set result variable so:
$data = printf ("%s,", $row["column"]);
i output of 22611,21435,23327,22876,22986,23692,21581,21832,22337,24313,22174,24368,6
why adding value? adding result variable incorrectly? fyi, snippet code, have error handling in place.
use sprintf()
instead (it works printf()
). 'silences' , gives homecoming value.
php mysql
No comments:
Post a Comment