php + mysql: creating queries

InnoroUnreany

New Member
Supose, that you need to insert into table of db row with values \[code\]$a, $b, $c\[/code\], 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\[code\]$query = "INSERT INTO `" . self::TABLE . '` ' . "(a, b, c) VALUES (" . . intval(a) . ",'" . mysql_real_escape_string(b) . "'" . ",'" . mysql_real_escape_string(b) . "')";\[/code\]Here's the question: is there a more elegant way to create a query?
 
Back
Top