doucong6884 2014-11-30 11:10
浏览 62
已采纳

如何获取用户在php-mysql中保存在表上的第一行

My webpage basically saves and fetches information about the employment history of an employee; Each employee having at least 10 to 15 work experience with the company; My issue is that i am having trouble fetching the data for date hired.

Here are the details of table wexp

LNAME|FNAME|WFROM|WTO|PT|DEPT|MS|SGSI|SOA|GOVS

I was wondering if it is possible to fetch the last row for a specific employee something like in mysql_fetch_assoc

 $wexp = "SELECT * FROM wexp WHERE LNAME='$lname' && FNAME='$fname';
 $viewwexp = mysql_query($wexp,$con);
 while($row = mysql_fetch_assoc($viewwexp))

Any assistance is much appreciated; I am also open for suggestion if you think what i have in mind is not possible

Thanks in advance.

  • 写回答

2条回答 默认 最新

  • drmeu26880 2014-11-30 11:56
    关注

    For those who have the same concern as i am; Since the table was using auto increment for ID; All i needed was to check the highest id save for that specific employee; My code is shown below

    SELECT * FROM wexp WHERE LNAME='$lname'&& FNAME='$fname' ORDER BY id DESC LIMIT 1
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题