Tuesday, June 16, 2009

Workaround for inconsistent issue with mySql query handling integer id




We faced some inconsistent issue with MySql query.

When we tried to use below mysql query we got error.

$query1="delete from emp_table where emp_id=$emp_id";

So, we tried below query.
$query1="delete from emp_table where emp_id=”.$emp_id;

But this way also didn't work. So, we made change like in following statement, it works good without any issue.

$query1="delete from emp_table where emp_id=' ".(integer)$emp_id." ' ";


More Articles...

No comments: