[Database class] checking values going into db
Paul S. Wang
pwang at cs.kent.edu
Thu Mar 8 17:48:34 EST 2012
Dear DB class,
Please note that it is important when inserting and updating
tables that the values going into the DB are correct.
This is especially true if the values are strings from command-line
input (or web form input).
For example if you enter a -2 or a "FOO" string into a qty field,
you would be very sorry.
Here are some PHP functions that can help:
<?php
$str = '232.98 The';
echo floatval($str); // 232.98
echo "\n";
echo intval($str); // 232
?>
Paul
--
==============================================================================
Paul S. Wang (王士弘) Email: pwang at cs.kent.edu
Dept. of Computer Science, Kent State U. Tel: (330) 672-9051
Kent, Ohio, USA 44242-0001 http://www.cs.kent.edu/~pwang/
==============================================================================
More information about the Dbclass
mailing list