tags:

views:

720

answers:

2
SELECT COUNT(*) AS test FROM %s WHERE id = %d AND tmp_mail <> ''

What are %s and %d for?

+2  A: 

That are probably format symbols for string and decimal integer.

Gumbo
+5  A: 

Those are format symbols used e.g. by sprintf(). Example:

<?php
 $sql_template = "SELECT COUNT(*) AS test FROM %s WHERE id = %d AND tmp_mail <> ''";
 $sql_real = sprintf($sql_template, 'sometable', 12345);
 echo $sql_real;
?>

Output:

SELECT COUNT(*) AS test FROM sometable WHERE id = 12345 AND tmp_mail <> ''
Piskvor