- sprintf: documentation ( source)
<?php
$sql = sprintf('SELECT *
FROM %s
INNER JOIN %s a ON (a.user_id = created_by)
LEFT JOIN %s b ON (b.user_id = modified_by)
WHERE provider_name LIKE "%%?%%"
LIMIT ?,?', TABLE_NAME1, TABLE_NAME2, TABLE_NAME3);