1

here my code-

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

status is int type.
it is showing parse error.

1
  • Probably a nice SQL injection on $pin_no. Commented May 29, 2010 at 16:37

3 Answers 3

6

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

Sign up to request clarification or add additional context in comments.

3 Comments

when shoul I use status = '0' or status = "0"
it does not matter. quotes are significant for strings, ints can be used with any quotes, or even without them.
When should you use quotes around numeric values? The answer is NEVER.
0

Have you tried?

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

1 Comment

when shoul I use status = '0' or status = "0"
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).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.