简体   繁体   English

php点和mysql点不匹配

[英]php dot and mysql dot doesn't match

Hi I have a table that looks like this: 嗨,我有一张桌子,看起来像这样:

|   vend   |   prod_name   |   price   |   qty   |
|----------|---------------|-----------|---------|
|   vend1  |   red wine    |   15.00   |    3    |
|----------|---------------|-----------|---------|
|   vend1  |  nike tg. 42  |   70.00   |    10   |
|----------|---------------|-----------|---------|

the problem with the code below is that when I update qty for red wine all works fine, but when I do the same thing with nike tg. 以下代码的问题是,当我为红酒更新数量时,一切正常,但是当我对耐克tg做同样的事情时。 42 the update doesn't work. 42更新不起作用。 I think that the problem is that dot that I can't remove. 我认为问题是无法删除的点。 The default charset of the database is latin1 and collate is latin1_general_cs. 数据库的默认字符集为latin1,排序规则为latin1_general_cs。

 $connection = mysqli_connect($host, $DBuser, $Dbpass, $databaseName);
 $query = 'update prodotti set qty = ? where vend = ? and prod_name = ?';
 $st = mysqli_prepare($connection, $query);
 mysqli_stmt_bind_param($st, 'iss', $value, $_SESSION['NomeUtente'], $key);
 mysqli_stmt_execute($st);
 mysqli_stmt_close($st);

Note that I've already print $key variable and it is exactly nike tg. 请注意,我已经打印了$ key变量,它就是耐克tg。 42 42

use a query like this 使用这样的查询

update prodotti set qty = '11' where vend = 'vend1' and prod_name = 'nike tg. 42';

i only want to show to use that value you obtained in a single quote the above query i had given worked fine for me i think mysqli_stmt_bind_param() causing error bcos u are not able to get single quotes with it try with direct query and get value in itself try and reply if any error 我只想显示使用您在单引号中获得的值,上面给出的查询对我来说效果很好,我认为mysqli_stmt_bind_param()导致错误bcos u无法获得单引号,请尝试直接查询并获取值本身尝试并回答是否有任何错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM