作者:ecrbw_9870105634 | 来源:互联网 | 2023-05-17 22:58
Ihavebeenstrugglingwiththisforthreedaysnowandthisiswhatihavegotandicannotunderst
I have been struggling with this for three days now and this is what i have got and i cannot understand why i am seeing this behavior.
我已经挣扎了三天了,这就是我所得到的,我不明白为什么我看到这种行为。
my problem is that i have a MySql spanish db with char set and collation defined as utf8_general_ci. when i query the data base in delete.php like this "DELETE FROM countryNames WHERE country = '$name'"
我的问题是,我有一个带有char设置和排序的MySql西班牙db,定义为utf8_general_ci。当我在delete中查询数据库时。php类似于"从国家名中删除,其中国家= '$name'"
the specified row doesnot get deleted. i am setting the variable $name in delete.php through a post variable $name=$_post['data']
. mostly $name gets the value in spanish characters e.g español, México etc. the delete.php file gets called from main.php.if i send a post message from main.php $.post("delete.php", {data:filename});
, the query doesnot deletes the entry (although the 'filename' string is in utf8) but if i create a form and then post my data variable in main.php, the query works!! the big question to me is why do i have to submit a form for the query to work? what im seeing is my database rejects the value if it comes from a jquery post call but accepts it when its from a submitted form. (i make no code change for the query to work. just post the value by submiting the form)
指定的行不会被删除。我在delete中设置变量$name。php通过post变量$name=$_post['data']。$name通常用西班牙语字符e表示。西班牙,墨西哥等国家删除。从main.php调用php文件。如果我从main发送邮件。php $ . post(“删除。php”,{数据:文件名});,查询不会删除条目(尽管“文件名”字符串在utf8中),但是如果我创建一个表单,然后将数据变量以main的形式发布的话。php,查询工作! !对我来说,最大的问题是为什么我必须提交一个表单才能进行查询?我看到的是我的数据库拒绝来自jquery post调用的值,但接受来自提交表单的值。(对于查询,我不做任何代码更改。只要提交表单就可以了)
4 个解决方案