Supose, that you need to insert into table of db row with values $a, $b, $c
, the values can be unsafe, name of table is stored in the class performing the operation as constant. It's possible to make query as follows
$query = "INSERT INTO `" . self::TABLE . '` ' .
"(a, b, c) VALUES (" .
. intval(a) .
",'" . mysql_real_escape_string(b) . "'" .
",'" . mysql_real_escape_string(b) . "')";
Here's the question: is there a more elegant way to create a query?