Skip to content

Instantly share code, notes, and snippets.

@schakko
Created April 5, 2011 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schakko/903575 to your computer and use it in GitHub Desktop.
Save schakko/903575 to your computer and use it in GitHub Desktop.
gambio_xtc_converter
<?php
// Gambio to XTC image converter - PHP pseudocode - not tested
// Gambio product table
$sql = "SELECT id, products_name FROM gambio.products_description"
$rows = mysql_fetch_assoc(mysql_query($sql))
foreach ($rows as $row) {
// match string, e.g "printer (white)"
if (preg_match("/^(.*)\((.*)\)(.*)$", $row['products_name'], $arrMatches)) {
$color = $arrMatches[2]; // third element contains color
// do something with color, e.g
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment