demolaynyc 0 Report post Posted December 14, 2006 Hi, the problem I'm having right now is that the hebrew text that are entered in my MySQL database display as "??? ???? " question marks when I load them up into my php page. Here's the MySQL Database: SQL result Host: localhost Database: kiklop_videos Generation Time: Dec 14, 2006 at 04:25 PM Generated by: phpMyAdmin 2.9.1.1 / MySQL 5.0.27-community SQL query: SELECT * FROM `videos` LIMIT 0, 30 ; Rows: 3 id name description url img 2 Go GoGo http://forums.xisto.com/no_longer_exists/ img1 4 Long Text ××× ×Š×¨× ××××× ×Š×ר ××× × ×××ר sw03.bezeqint.net/cunet/gm.asp?format=wm&ci=1895&ak=null&ClipMediaID=2165 img3 5 ×׊ ×× ×××× × ××רת ××× ×Š×¨× ××××× ×Š×ר ××× × ×××ר http://forums.xisto.com/no_longer_exists/ img2 Now here's the php code to display the values: <!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; <!--xmlns="www.w3.org/1999/xhtml http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />--><title>Untitled Document</title><style type="text/css"><!--#data_table, td { border: solid 1px #CCCCCC; }#data_table { width: 80%; }body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}.style11 {color: #FFFFFF; font-size: 14px; font-weight: bold; }--></style></head><body><table border="0" align="center" cellpadding="3" cellspacing="0" id="data_table"> <tr> <td width="50" bgcolor="#FF0000"><span class="style11">id</span></td> <td bgcolor="#FF0000"><span class="style11">Name</span></td> <td bgcolor="#FF0000"><span class="style11">Description</span></td> <td bgcolor="#FF0000"><span class="style11">URL</span></td> <td bgcolor="#FF0000"><span class="style11">Image Src </span></td> </tr> <? //This displays each row of data $username = "root"; $password = ""; $database = "kiklop_videos"; $videosDB = mysql_connect(localhost, $username, $password); mysql_select_db($database, $videosDB); $query = "SELECT * FROM videos"; $result = mysql_query($query); $num = mysql_numrows($result); $gray = 0; //0 for no-bgcolor row; 1 for gray-bgcolor row for ($i=0; $i<$num; $i++) { //loop until no more data //Get ID $query = "SELECT id FROM videos"; $result = mysql_query($query); $id = mysql_result($result, $i); //Get Name $query = "SELECT name FROM videos"; $result = mysql_query($query); $name = mysql_result($result, $i); //Get Description $query = "SELECT description FROM videos"; $result = mysql_query($query); $description = mysql_result($result, $i); //Get URL $query = "SELECT url FROM videos"; $result = mysql_query($query); $url = mysql_result($result, $i); //Get IMG $query = "SELECT img FROM videos"; $result = mysql_query($query); $img = mysql_result($result, $i); if ($gray == 0) { print "<tr> <td width=\"50\">". $id ."</td> <td>". $name ."</td> <td>". $description ."</td> <td>". $url ."</td> <td>". $img ."</td> </tr>"; $gray = 1; //toggle $gray value } else { print "<tr> <td width=\"50\" bgcolor=\"#EAEAEA\">". $id ."</td> <td bgcolor=\"#EAEAEA\">". $name ."</td> <td bgcolor=\"#EAEAEA\">". $description ."</td> <td bgcolor=\"#EAEAEA\">". $url ."</td> <td bgcolor=\"#EAEAEA\">". $img ."</td> </tr>"; $gray = 0; //toggle $gray value } } ?> </table></body></html> What I get is this: (please view it in an html editor) <!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; <!--xmlns="www.w3.org/1999/xhtml" http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />--><title>Untitled Document</title><style type="text/css"><!--#data_table, td { border: solid 1px #CCCCCC; }#data_table { width: 80%; }body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}.style11 {color: #FFFFFF; font-size: 14px; font-weight: bold; }--></style></head><body><table border="0" align="center" cellpadding="3" cellspacing="0" id="data_table"> <tr> <td width="50" bgcolor="#FF0000"><span class="style11">id</span></td> <td bgcolor="#FF0000"><span class="style11">Name</span></td> <td bgcolor="#FF0000"><span class="style11">Description</span></td> <td bgcolor="#FF0000"><span class="style11">URL</span></td> <td bgcolor="#FF0000"><span class="style11">Image Src </span></td> </tr> <tr> <td width="50">2</td> <td>Go</td> <td>GoGo</td> <td>http://castup-sw03.bezeqint.net/cunet/gm.asp?format=wm&ci=1895&ak=null&ClipMediaID=2165</td> <td>img1</td> </tr><tr> <td width="50" bgcolor="#EAEAEA">4</td> <td bgcolor="#EAEAEA">Long Text</td> <td bgcolor="#EAEAEA">??? ??? ????? ??? ??? ????? </td> <td bgcolor="#EAEAEA">sw03.bezeqint.net/cunet/gm.asp?format=wm&ci=1895&ak=null&ClipMediaID=2165</td> <td bgcolor="#EAEAEA">img3</td> </tr><tr> <td width="50">5</td> <td>?? ?? ???? ?????</td> <td>??? ??? ????? ??? ??? ?????</td> <td>http://castup-sw03.bezeqint.net/cunet/gm.asp?format=wm&ci=1959&ak=67869204&ClipMediaID=2198</td> <td>img2</td> </tr> </table></body></html> I get question marks even thuogh the real values are in Hebrew in the database. WHAT's wrong? Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted December 15, 2006 I never use Hebrew characters but your problem seems to be with the Character set of your database, i have a time ago a similar problem and i correct it by set the character set of my database to UTF-8.Best regards, Share this post Link to post Share on other sites
miCRoSCoPiC^eaRthLinG 0 Report post Posted December 15, 2006 First of all you've to declare the particular fields in MySQL that store Hebrew to be of the hebrew character collation. The collation is named hebrew. If you don't do this, those fields won't be able to store hebrew.. You can easily use some open-source tool like SQLYog from https://www.webyog.com/'>https://www.webyog.com/ and manipulate your database to declare a particular field to be of the hebrew collation. Or, as TavoxPeru stated, you can set the whole table to Hebrew collation and not bother about any particular field. If you do so, you can still store a mix of Hebrew and English in the same table.. Setting a table or a field to a particular character-collation means enabling it to store that character-set apart from english. Here's a short list of the collations available in MySQL: http://dev.mysql.com/doc/refman/5.7/en/charset-mysql.html https://l'>https://l https://l'>https://l'>http://dev.mysql.com/doc/refman/5.7/en/charset-mysql.html https://l'>https://l https://l'>https://l and their collation codes. Secondly, while accessing the database, you've to pass CHARSET=utf8 along with the connection string, so that MySQL hands out the results in UTF8 format to php and not just plain ASCII encoding.. Share this post Link to post Share on other sites
demolaynyc 0 Report post Posted December 15, 2006 Thanks a lot for the help. I'll go and try that now. Share this post Link to post Share on other sites