php是name = 1和id =相等的数字但未指定

时间:2016-01-02 07:44:15

标签: php mysql sql

$sql = "SELECT title, nodeid FROM node 
 where contenttypeid='30' and starter=equal nubber(but Not a fixed number) 
 order by nodeid desc limit 10";

有人能帮助我吗?什么是使用“和starter = equal nubber(但不是固定数字)”

的正确方法

1 个答案:

答案 0 :(得分:0)

如果只需要整数,则可以使用(int)代替(float)

$number = 12.112; //some number
$sql = "
    SELECT title, nodeid 
    FROM node 
    WHERE contenttypeid= 30 and starter = " . (float) $number . "
    ORDER BY nodeid desc 
    LIMIT 10
";