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());
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?