I have a problem with select statement in mysql, i have a table like with two columns:
cz - varchar(64) - utf8_general_ci
pl - varchar(64) - utf8_general_ci
values:
pl - kwota sumaryczna
cz - celková částka
When in form I type částka i can't find anything, but when i type castka i will find data.
What I should change in my code to make this work for words with czech signs and for words with polish signs?
On web page I have code:
<form method="post" action="dict.php?go" id="searchform">
<input type="text" name="name" pattern=".{0}|.{2,}" required title="Conajmniej 2 litery" class="keyboardInput" size="50">
<input type="submit" name="submit" value="Szukaj">
</form>
<br>
<?php
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){
$name=$_POST['name'];
//connect to the database
$db=mysql_connect ("host", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error());
//-select the database to use
$mydb=mysql_select_db("base");
mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
//-query the database table
$sql="SELECT pl, cz FROM slow WHERE pl LIKE '%" . $name . "%' or cz LIKE '%" . $name . "%'";
//-run the query against the mysql query function
$result=mysql_query($sql);`