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条)

报告相同问题?