开发者

how to pass int values in mysql query string?

开发者 https://www.devze.com 2023-01-01 18:12 出处:网络
here my code- $sqlpin = \"SELECT pinId FROM tblpin WHERE pinId = \'$pin_no\', st开发者_开发知识库atus = 0 \";

here my code-

$sqlpin = "SELECT pinId FROM tblpin WHERE pinId = '$pin_no', st开发者_开发知识库atus = 0 ";

status is int type.

it is showing parse error.


SELECT pinId FROM tblpin WHERE pinId = '$pin_no' AND status = 0


Have you tried?

$sqlpin = "SELECT pinId FROM tblpin WHERE pinId = '$pin_no' and status = 0 ";


Syntax error is caused by comma in WHERE clause. You should use AND logical operator to connect these two conditions.

btw: If some column has numeric type don't pass values with apostrophes, just: colName = 123. Only text values requires apostrophes/quotes (in MySQL both has exactly the same meaning).

0

精彩评论

暂无评论...
验证码 换一张
取 消