Home >Backend Development >PHP Problem >How to query a certain field in php

How to query a certain field in php

藏色散人
藏色散人Original
2021-09-16 09:46:023015browse

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.

How to query a certain field in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn