ورود

View Full Version : ارسال پارامتر فارسی به کوئری استرینگ



Site Admin
جمعه 20 آذر 1394, 21:13 عصر
سلام من خیلی با PHP وارد نیستم
یک سری اطلاعات رو با PHP از طریق کوئری استرینگ میگیریم شبیه این







Show.php?code=15&info=تست


محتویات فایل SHOW



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php



header('Content-Type: text/html; charset=utf-8');

$hostname='localhost';
$username='udb';
$password='pass';

$code = $_GET['code'];
$info= $_GET['info'];


$dbh=new PDO("mysql:host=$hostname;dbname=moerapp",$usernam e,$password);
$dbh=new PDO("mysql:host=$hostname;dbname=moerapp",$usernam e,$password);


}

echo json_encode($response);


$count=$dbh->exec("INSERT INTO tbl_test (code,info) VALUES ('$code','$info')");


}catch(PDOException $e) {
echo $e->getMessage();
}

?>







نوع فیلد info از نوع varchar و Collation utf8_general_ci می باشد

وقتی کوئری استرینگ فارسی میفرستم در جدول نامفهومه مشکلی با درج اطلاعات ندارم فقط مشکلم ارسال مقدار فارسی هست

tamafi6
یک شنبه 22 آذر 1394, 21:23 عصر
کلمات فارسی وانگلیسی رامحدودکنید



function cleanSEF($string) { $string = str_replace(' ', '-', $string); $string = preg_replace('/[^0-9a-zA-Z-_]/', '', $string); $string = str_replace('-', ' ', $string); $string = preg_replace('/^\s+|\s+$/', '', $string); $string = preg_replace('/\s+/', ' ', $string); $string = str_replace(' ', '-', $string); return strtolower($string);}function cleancheckSEF($string) { return $ret;}