Jump to content

[SOLVED] Problem with Collation


ballouta

Recommended Posts

Hi,

I am trying to read a column 'bname' from table 'books', this column has the collation (utf8_unicode_ci), then insert this column info into another table to same field name and same collation

but the inserted info are garbage and corrcupted (اجابة الداعي الى بيان اعتقا...)

my code

<?php
$query = "SELECT * FROM `books` order by `ncode` ASC ";
$result = mysql_query($query);
while( $row = mysql_fetch_array($result) )
{
$result2 = mysql_query("INSERT INTO `stats` (`ncode` ,`bname` ,`num` )VALUES ('$row[ncode]', '$row[bname]', 0)");
echo "Book: $row[bname] was inserted <br>";
}
?>

 

Please help

 

thank you

Link to comment
Share on other sites

 

@ realjumper:

The output is correct because i already have this in the head:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="Content-Language" content="ar-lb">

 

and this link in PHP:

<?php
mysql_query("SET CHARACTER_SET_RESULTS=NULL");
?>

 

@discomatt: Thank you very much, this link solved the problem for me, the second table was filled with readable info (arabic characters)

 

Thank You ALL

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.