Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

create two tables, default collation is "latin1_swedish_ci” and other table with collation “utf8 COLLATE utf8_persian_ci”

Avatar of patrik20
patrik20 asked on
Microsoft SQL Server
9 Comments1 Solution1357 ViewsLast Modified:
Hi

I try to create two tables, the first one has the default collation "latin1_swedish_ci”  and the other table should has collation “utf8 COLLATE utf8_persian_ci”,  and I will insert Persian text into the second table.
But my script creates both tables with the default collation "latin1_swedish_ci” , and put ???? in the second table.

Here is the code. What am I missing / doing wrong?

<?
include ("serverdata.php");

$con = mysql_connect($dbHost,$dbUser,$dbPass);
mysql_select_db($dbName, $con);
$query1="
CREATE TABLE admin (
  id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  username VARCHAR( 11 ) NOT NULL ,
  password VARCHAR( 11 ) NOT NULL ,
  email VARCHAR( 50 ) NOT NULL
) TYPE=MyISAM";

$query2="INSERT INTO admin VALUES (1, 'över', 'för titel1 på svenska', 'webb@hotmail.com');";

$query3="
CREATE TABLE subjectir (
  id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  title1f TEXT( 200 ) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL ,
  title2f TEXT( 200 ) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL ,
  textf TEXT( 1500 ) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL  
) TYPE=MyISAM";

$query4="INSERT INTO subjectir VALUES (1, ' some persian text, .', ' some persian text ', ' some persian text ');";

$result1 = mysql_db_query($dbName,$query1) or die('Error1: creating admin table');
$result2 = mysql_db_query($dbName,$query2) or die('Error2: inserting in admin table');
$result3 = mysql_db_query($dbName,$query3) or die('Error3: creating subjectir table');
$result4 = mysql_db_query($dbName,$query4) or die('Error4: inserting in subjectir table');

echo "<FONT SIZE=4><b>All tables created successfully</b></FONT><BR><BR>";
?>
ASKER CERTIFIED SOLUTION
Avatar of QPR
QPRFlag of New Zealand image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers