Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL db question marks instead of hebrew characters..?

I'm trying to build a shopping cart using PHP & MySQL. my db in MySQL is utf8 and my table in the db is utf8,

How can I use Hebrew characters?

like image 965
Amir Avatar asked Mar 13 '11 06:03

Amir


People also ask

What is question mark in MySQL query?

The question mark represents a parameter that will later be replaced. Using parameterized queries is more secure than embedding the parameters right into the query. SQL Server calls this parameterize queries, and Oracle calls it bind variables.


1 Answers

I was able to solve this by doing the following:

  1. the db collation has to be utf8_general_ci
  2. the collation of the table with hebrew has to be utf8_general_ci
  3. in your php connection script put header('Content-Type: text/html; charset=utf-8');
  4. in xhtml head tag put <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. after selecting the db in the connection script put mysql_query("SET NAMES 'utf8'");
like image 121
amir Avatar answered Oct 04 '22 22:10

amir