Categories

Category Specific RSS

Escape characters in a MySQL statement

$query = "SELECT * FROM users WHERE username=’" . $username . "’            AND password=’" . $password . "’";   // the record exists function is defined elsewhere if (record_exists($query)) { echo "Access granted"; } else { echo "Access denied"; }

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare

a MySQL search function

if (!function_exists(‘mysql_search’)) {      function mysql_search($table, $columns, $query = ”, $options = Array()) {         if (empty($query)) { return Array(); }         $sql_query = Array();         $options[‘columns’] = isset($options[‘columns’])?$options[‘columns’]:’*’;       $options[‘method’] = isset($options[‘method’])?$options[‘method’]:’OR’;       $options[‘extra_sql’] = isset($options[‘extra_sql’])?$options[‘extra_sql’]:”;         $query = ereg_replace(‘[[:<:]](and|or|the)[[:>:]]’, ”, $query);       $query = ereg_replace(‘ +’, ‘ ‘, […]

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare