dou5454954610 2012-05-03 04:34
浏览 78
已采纳

在Where子句中使用数组

So what I need to do is find in my tables where id = id and name = name. I have tried this with no success.

$sql="SELECT * FROM $mysqltable WHERE id='$id' && name='$name'"

EDIT I found that I was missing a } bracket below this and the above code does work :/ Thank you everyone.

  • 写回答

1条回答 默认 最新

  • douhai9043 2012-05-03 04:44
    关注

    This is how i would have done it: Also try entering the table name instead of a variable.

    $sql = "SELECT * From $mysqltable WHERE id='$id' AND name='$name'";
    
    $result = mysql_query($sql) or die(mysql_error());
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效