Home > Backend Development > PHP Tutorial > 怎么实现每个学生在登入后 怎么通过数据库查询name字段来对应各自的$_COOKIE['name']然后循环输出各自姓名和年龄

怎么实现每个学生在登入后 怎么通过数据库查询name字段来对应各自的$_COOKIE['name']然后循环输出各自姓名和年龄

PHP中文网
Release: 2016-06-20 12:36:09
Original
1315 people have browsed it

有一个数据表student  
里面的字段有    id  name  age   
字段下的值有     1  张三  17  
                             2  李四  18  
                             3  王五  18  
                             4  张三  17  
                             5  王五  18  
设置了$_COOKIE['name']  
我想实现每个学生在登入后  
怎么通过数据库查询name字段来对应各自的$_COOKIE['name']然后循环输出各  
自姓名和年龄  
这段代码应该怎么写


解决方案

select * from student where name='$_COOKIE[name]'

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template