Home >Database >Mysql Tutorial >mysql-JSP怎么获取在MySql中查询到的数据中的指定值?

mysql-JSP怎么获取在MySql中查询到的数据中的指定值?

WBOY
WBOYOriginal
2016-06-06 09:33:391146browse

mysqljsp

图片说明

这是我的table结构,一共6列,主键是id,table名是user,现在想通过查找username来获取指定username的name值,并存入session中,用SELECT * FROM user where 语句可以获取一行值,如果我只要取name列的值,代码应该怎么写呢?比如我想取username为zeng的用户的name值,应当怎么写?
之前遇到个问题卡了很久,提问求个例子之后大家都只说个大概思路,无奈只好把问题拆分开来问,希望这次能得到较为详细的解答……

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