MySQL PHP statements is returning junk data included with the records -
lately newly created tables in mysql database returning "\r\n\r\n\r\n" on select statements along stored data. don't know junk data coming because not visible in phpmyadmin. happening in newly created tables, doesn't happen in old ones.
i used phpmyadmin create table, here exact statement create it:
create table if not exists `user_analysis` ( `project_id` int(11) not null, `ugroupid` int(11) not null, `user_address` text character set utf8 collate utf8_bin not null, `user_strengths` text character set utf8 collate utf8_bin not null, `user_weaknesses` text character set utf8 collate utf8_bin not null ) engine=innodb default charset=utf8;
the table information this:
type: innodb collation: utf8_general_ci
here query i'm making:
$query = "select user_strengths user_analysis `project_id` = ? , `ugroupid` = ?"; if($stmt = $mysqli->prepare($query)){ $stmt->bind_param("ii", $this->pid, $this->gid); $stmt->execute(); $stmt->bind_result($strengths); $stmt->fetch(); echo $strengths; }
i tried not using prepared statements , hard coding query, still returns junk data. tried this:
$query = "select user_strengths user_analysis `project_id` = '10256' , `ugroupid` = '10'"; $result = $mysqli->query($query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); echo "user strengths: " . $row["user_strengths"]; }
i used answer found here temporary fix: replacing \r\n php
but working around not problem. problem shouldn't happen begin with. causing mysql return junk data? again, junk data not visible phpmyadmin. tried inserting data directly phpmyadmin , make sure there no such thing "\r\n\r\n\r\n" in inserted, still returns junk data along records.
any ideas?
Comments
Post a Comment