Mysql: how to create field of hebrew language

Hi everyone
This is how I created my table:


CREATE TABLE heb
(
	remark VARCHAR(100) collate utf8_unicode_ci 
);

This is how that table is displayed with phpadmin:

Here is how I added Hebrew value to the field in that table:

INSERT INTO heb (remark) SELECT 'אבג';

In order to see the field’s value on a web page I use the following PHP code:

<?php // heb.php
require_once 'myInitial.php';
require_once 'myLogin.php';
MYSQLI_SET_CHARSET($myConnection,'UTF8');
$hebQUE = "select * from heb";
$myResult = $myConnection->query($hebQUE);
if (!$myResult) die ("Database access failed: " . $myConnection->error);
$numOfRows = $myResult->num_rows;

echo <<<_END
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
_END;
for ($j = 0 ; $j < $numOfRows ; $j++)
{
	$myResult->data_seek($j);
	$row = $myResult->fetch_array(MYSQLI_ASSOC);
	echo <<<_END
		{$row["remark"]}
_END;
}
$myResult->close();
$myConnection->close();
?>

Here is what I get on my display when I upload that page:

Gibrish…
Can anyone show me how to format a column in a MySQL table to show values in Hebrew?
Thanks

In your CREATE you specify the collation, but not the character set?
Is the databases default character set also UTF-8 ?

Does your page have <meta charset="UTF-8"> or equivalent after the opening <head> tag ?

Here is how I created the database and the table:

CREATE DATABASE hebDB CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE hourshifts
(
	counter INT UNSIGNED NOT NULL AUTO_INCREMENT KEY,
	shiftdate DATE  NOT NULL, 
 	employer TINYINT(4)   UNSIGNED NOT NULL,
	location TINYINT(4)   UNSIGNED NOT NULL,
	exam TINYINT(4) UNSIGNED NOT NULL ,
	startime TIME NOT NULL,
	endtime TIME NOT NULL,
	totalshift FLOAT(5,2),
	rate DECIMAL(5,2),
	shiftpay DECIMAL(6,2),
	remark VARCHAR(100) collate utf8_unicode_ci 
);

After input 203 rows of which one column is in hebrew this is what I got:

Thanks !

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.