Skip to content

Instantly share code, notes, and snippets.

@bdenckla
Created February 4, 2012 01:16
Show Gist options
  • Save bdenckla/1734236 to your computer and use it in GitHub Desktop.
Save bdenckla/1734236 to your computer and use it in GitHub Desktop.
Escape SQL (MySQL?) database name for grant
<?php
function escape_database_for_grant( $d )
{
$search = array( '_', '%' );
$replace = array ( '\_', '\%' );
return str_replace( $search, $replace, $d );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment