php的SELECT语句问题

时间:2017-03-12 14:32:20

标签: linux php

+--------------+------+
| 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" ... 可能是什么问题?

1 个答案:

答案 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