How to query a certain field in php

藏色散人
Release: 2023-03-12 15:40:01
Original
2996 people have browsed it

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;
Copy after login

or

   $sql = "SELECT * FROM  `cabinet` WHERE state_M =0 LIMIT 0 , 1";
   $data = $mysql->getData( $sql );
   $cabinet_id = $data[0]['cabinet_id'];
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template