2011-06-02 4 views
0

Hej guys、MySQLのテキストフォーマット

データベースにアクセスし、特定のクエリで見つかった行を表示する小さなPHPスクリプトを作成しました。それは彼らと一緒にテーブルをエコーし​​ますが、いくつかのタイプセットエラーがあり、疑問符が表示されるようです。私はこれを解決するために何ができるのかを知っていますか?ここではスクリーンショットです:テキストの書式 ">

はここで私は、データを取得し、表示するために使用しているコード

$result = mysql_query($sql); 
     if(mysql_num_rows($result)>0){ 
      echo "<div style='float:top;clear:both;'>"; 
      echo "<table border='1'>"; 
      echo "<th>id</th><th>project</th><th>publisher</th><th>country</th><th>contact</th><th>mail</th><th>agent</th><th>report</th><th>todo</th><th>by who</th><th>done(date,text)</th><th>priority</th>"; 
      while($row = mysql_fetch_array($result)){ 
       echo "<tr>"; 
       echo "<td>".$row[0]."</td><td>".$row[1]."</td><td>".$row[2]."</td><td>".$row[3]."</td><td>".$row[4]."</td><td>".$row[5]."</td><td>".$row[6]."</td><td>".$row[7]."</td><td>".$row[8]."</td><td>".$row[9]."</td><td>".$row[10]."</td><td>".$row[11]."</td>"; 
       echo "<td><form method='POST' action='insert.php'><input type='submit' name='edit' value='edit'/><input type='hidden' name='hiddenID' value='".$row[0]."' /><input type='hidden' name='hiddenDB' value='".$_POST['db']."' /><input type='hidden' name='hiddenProject' value='".$row[1]."' /><input type='hidden' name='hiddenPublisher' value='".$row[2]."' /><input type='hidden' name='hiddenCountry' value='".$row[3]."' /><input type='hidden' name='hiddenContact' value='".$row[4]."' /><input type='hidden' name='hiddenMail' value='".$row[5]."' /><input type='hidden' name='hiddenAgent' value='".$row[6]."' /><input type='hidden' name='hiddenReport' value='".$row[7]."' /><input type='hidden' name='hiddenTodo' value='".$row[8]."' /><input type='hidden' name='hiddenBywho' value='".$row[9]."' /><input type='hidden' name='hiddenDone' value='".$row[10]."' /><input type='hidden' name='hiddenPriority' value='".$row[11]."' /></form></td>"; 
       echo "</tr>"; 
      } 
      echo "</table>"; 
      echo "</div>"; 

PSだ:ドイツのような特殊文字と思われる『ß』も挿入さばかりaren¿t適切にデータベースに私はデータを表示するなどのphpMyAdmin

+0

としてあなたのPHPスクリプトの打ち上げでhttp://imageshack.us/photo/my-images /6/bugsql.png/ –

+0

utf-8照合を使用していますか? – Kamil

答えて

1

UTF-8文字セットを使用することをお勧めします。

あなたはutf8_general_ci

にあなたのテーブル/ colunmnの文字セットを作るべきであり、その後絵forogt最初のクエリ

SET NAMES 'utf-8' 
0

を使用してデータセットを検査する場合、キリル文字で同じ問題がDBからデータを取得する前に、次のコードを実行することによって解決される:

mysql_query ("set character_set_client='cp1251'"); 
mysql_query ("set character_set_results='cp1251'"); 
mysql_query ("set collation_connection='cp1251_general_ci'"); 

あなたのケースに適切なドイツ語の文字セットを使用してください。

関連する問題