: This article mainly introduces the type of data that PHP obtains from the database. if you are interested in the PHP Tutorial, please refer to it. What some code can do today is: 1. read data from the database 2. judge the value and process the subsequent business logic based on the judgment result
Step 1: Read fields from the database: in table $ table_name, the Id field data type is int
Select Id from $ table_name
$ Id = $ value ['id'];
Step 2: judge the value: if ($ id = 1 ){....}
Because the subsequent logic is not executed, I print the $ id. the true value is 1.
Then I did what every programmer would do: deny the reality-how can this be wrong? it is clearly like this, this is not possible (I am always happy here ~). I finally began to have all kinds of doubts. then I saw it ), the returned result is: string! Therefore, in PHP, when judging the value obtained from the database, use = to be careful. Then, the problem is solved.
I asked the great god. The Great God said that php was originally a weak language. no one specified the type of data returned by a select statement .. The bug has been found for so long, so it is sent ..
The above section describes the types of data that PHP obtains from the database, including the relevant content, and hopes to help those who are interested in the PHP Tutorial.