dongsaohu6429
2015-05-28 17:53
浏览 65
已采纳

回声数组数据将所有文本转换为小写

I am having some problems fetching the array from my database properly. All my text is being echoed in lowercase. While the text in the database is both lower & uppercase. How can make it fetch properly? This is my actual SQL request:

$page = (int) (!isset($_GET['p'])) ? 1 : $_GET['p'];
$sql = "SELECT * FROM newsfeed_status AS ns LEFT OUTER JOIN login AS lo ON ns.user = lo.id WHERE ns.status_deleted is null ORDER BY ns.status_id DESC";
$start = ($page * $limit) - $limit;
if( mysql_num_rows(mysql_query($sql)) > ($page * $limit) ){
$next = ++$page;
}
$query = mysql_query( $sql . " LIMIT {$start}, {$limit}");
?>

I use this to start a while statement:

<?php while ($row = mysql_fetch_array($query)): ?>

and here I echo the status text using this:

<?php echo $row['post']?>

My input looks like this:

share my thoughts? i'll give you thoughts!

When I want this:

Share my thoughts? I'll give you thoughts!

This is my var_dump($row['post']); result:

share my thoughts? i'll give you thoughts!string(42) "share my thoughts? i'll give you thoughts!"

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dtzhfb4869 2015-05-28 17:56
    已采纳

    Well, in order to debug this there are a couple of questions and steps to follow, first, where are you echoing your data? Maybe you are wrapping it in a html tag that has a css attribute like text-transform: lowercase;? Another thing would be to just use var_dump($row['post']) in order to see if its really comming case sensitive from the database. Please share your html and css as well so we can fully debug your issue.

    After checking your question's edit, where the var_dump is, the problem seems to be in the database or maybe your css file. In your php code i've could not find anything that would make your test lowercase. Check your whole css and find lowercase (Just do a global search in your stylesheets for that word, maybe in your html or body css rules you are setting everything to lowercase.

    Another question, What happens if you just write a string in your page? Something like Hello, This is A Test STRING. Does it get lowercased as well?

    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题