dsd30433
2017-08-15 00:21
浏览 75
已采纳

在sql语句中包含变量的正确方法是什么[重复]

This question already has an answer here:

I want to include a variable in my sql statement but it's not outputting any data. How do I include a variable correctly?

$vStyles = $wpdb->get_results( 'SELECT slug from vf_venuestyles WHERE vid = "$vid"');

</div>

图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 这里有一个答案:

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongzaobei0942 2017-08-15 00:24
    已采纳

    Change the quote marks around: $vStyles = $wpdb->get_results("SELECT slug from vf_venuestyles WHERE vid = '$vid'");

    But, unless that function / class already does something magic about that, you should look into using something with proper prepared statements.

    评论
    解决 无用
    打赏 举报
  • 查看更多回答(2条)

相关推荐 更多相似问题