2013-06-27 14:35
浏览 119


this code is retrieving data sent from other page:


how to select data from data base and sorting it according to $playerStatictic

I'm using this code but won't work:

  $sql_playerstatistic="select * from ".$prev."playerstatistic where leagueID = $league ORDER BY $playerStatictic desc";

    $sql_team="select * from ".$prev."team where id=".$d_playerstatistic['teamID']."";


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doutongwei4380 2013-06-27 14:42

    This is probably your problem:


    When you want to use values in queries, you need to quote them, although a prepared statement with bound variables is recommended instead. When you want to use table- or field-names in queries, you should not quote them like you quote values, but you quote them using backticks if necessary (assuming mysql).

    However, that leaves you open to sql injection, so what you need to do when you want to inject table- and field-names in your queries, is check them against white-lists of allowed table- and field-names.

    打赏 评论

相关推荐 更多相似问题