You could have a form with a text field for the name of your new category and after you post the form, you call that function
PHP Code:
<?php
function add_category( $category_name )
{
mysql_query( "INSERT INTO gallery_category(`category_name`) VALUES('".addslashes( $category_name )."' )" );
}
if($_POST['submit']) {
add_categoy($_POST['category']);
}
?>
<form name="form" action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
<input type="text" name="category" />
<input type="submit" name="submit" value="add category" />
</form>
very basic version and you need to check for sql injection
Bookmarks