Na szybko pisane:
<?php
/**
* Query
*
* Pierwszy parametr to kod SQL, w ktorym kolejne znaki ? zostaja
* zastapione w kolejnosci podania parametrow. Dodatkowo parametry zastapiane pr
zez ? sa potraktowane mysql_escape_string() i htmlspecialchars()
*
* @param string $sSql
* @return resource
*/
function query( $sSql ) {
$i=1;
$sSql = preg_replace( '@?@es', 'mysql_escape_string( htmlspecialchars( $aParams[$i++], ENT_QUOTES ) )', $sSql, count( $aParams ) );
return $sSql; //mysql_query( $sSql );
}
echo query
( 'Select * from ? where pole = ?', 'tabela', 1
); ?>