What are best practices for integrating geshi with MySQL to select and highlight code between specific tags, such as [code]?

To integrate GeSHi with MySQL to select and highlight code between specific tags like [code], you can use regular expressions to extract the code within the tags and then apply GeSHi for syntax highlighting. One approach is to fetch the code from MySQL, use a regular expression to extract the code between [code] tags, and then pass that code to GeSHi for highlighting.

// Fetch the code from MySQL
$code = "SELECT code FROM your_table WHERE id = 1";

// Extract code between [code] tags using regular expression
preg_match('/\[code\](.*?)\[\/code\]/s', $code, $matches);
$code_to_highlight = $matches[1];

// Initialize GeSHi
require_once('geshi/geshi.php');
$geshi = new GeSHi($code_to_highlight, 'language');

// Display highlighted code
echo $geshi->parse_code();