Skip to content

PHP Reference Book Blog

PHP Reference: Beginner to Intermediate PHP5

Get the Book

  • Purchase
  • Free PDF
  • ePub Format
  • HTML Version
  • Corrections

Post Categories

  • Author Notes (1)
  • Clarifications (4)
  • Corrections (10)
  • Miscellaneous (7)
  • Samples (4)
  • Tips (14)

Tags

$_GET $_SERVER addslashes alphanumeric array_key_exists carriage return define easy ebook Function functions global include include_once index isset kindle language construct MySQL mysql_real_escape_string new line newline PCRE PERL php php5 php errors precision preg preg_match preg_replace query string query_string regular expression regular expressions require require_once sample security simple sprintf sql injection tab tip variables

Tag: precision

Sprintf() Tip

From the book:

For MySQL security, you can use sprintf() to force user input to have a maximum length and be valid for the structure of your database. Use the precision specifier to automatically parse the string submitted by GET or POST.

Posted on July 21, 2008September 28, 2011Categories TipsTags php, php5, precision, sprintf, tip1 Comment on Sprintf() Tip
Proudly powered by WordPress