Created
April 5, 2011 13:26
-
-
Save schakko/903575 to your computer and use it in GitHub Desktop.
gambio_xtc_converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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