+--------------+------+
| IP | Say |
+--------------+------+
| 192.168.1.1 | 1 |
+--------------+------+
$con = mysqli_connect("$host", "$user", "$pass", "$db_name") or die("cannot connect");
$Q1 = "SELECT Say From spam_engel WHERE IP = '192.168.1.1'";
$ol = mysqli_query($con, $q1);
echo gettype($ol);
打印的东西是" NULL"。但它应该是打印" int" ...
可能是什么问题?
答案 0 :(得分:0)
php variables
区分大小写:
PHP中的变量用美元符号后跟名称表示 变量。变量名称区分大小写。
所以在你的代码中:
{
"Title" : "TEST",
"ShortDescription" : "SD",
"LongDescription" : "LD"
}
此处您正在使用@Configuration
@EnableWebMvc
public class JacksonConfiguration {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
return mapper;
}
}
,然后传递给$Q1 = "SELECT Say From spam_engel WHERE IP = '192.168.1.1'";
$ol = mysqli_query($con, $q1);
小写变量$ q1;
修复此问题,统一变量名称的大小写如下:
$Q1