How to query a certain field in php: 1. Query data through the "select * from" statement; 2. Read the value through "$student_value['period'];"; 3. Through "echo $ Period;" can be used to output the query results.
The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer
How to query a certain field in php?
php Returns a certain field in the query result
The code is as follows:
global $mysql; //查询 $sql = "select * from `bookTable` where student_id = '".$student_id."'"; $student_value = $mysql->getLine( $sql ); //读值 $period = $student_value['period']; $state = $student_value['state']; //输出 echo $period;
or
$sql = "SELECT * FROM `cabinet` WHERE state_M =0 LIMIT 0 , 1"; $data = $mysql->getData( $sql ); $cabinet_id = $data[0]['cabinet_id'];
Recommended learning: "PHP Video Tutorial 》
The above is the detailed content of How to query a certain field in php. For more information, please follow other related articles on the PHP Chinese website!