The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
Liste table
Posted by: Oyo | October 10, 2010 @ 8:49am
PHP Code
[
Download
]
$id_customer = Tools::getValue('id_customer'); $prefixt = Tools::getValue('prefixt'); $tatabase = _DB_NAME_; $show_tables = "SHOW TABLES FROM ".$tatabase; $list_tables = Db::getInstance()->ExecuteS($show_tables); foreach ($list_tables as $k => $v) { $sql = 'SELECT (COLUMN_NAME) AS "'.$v['Tables_in_'.$tatabase].'" FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = "'.$v['Tables_in_'.$tatabase].'" AND (`COLUMN_NAME` = "id_customer") GROUP BY `'.$v['Tables_in_'.$tatabase].'` ORDER BY `'.$v['Tables_in_'.$tatabase].'`'; $list_column = Db::getInstance()->ExecuteS($sql); foreach ($list_column as $k2 => $v2) { if ($v['Tables_in_'.$tatabase] == _DB_PREFIX_.'address') { $sql = 'SELECT * FROM '.$v['Tables_in_'.$tatabase].' WHERE id_customer NOT IN (0,1,2)'; $ps = Db::getInstance()->ExecuteS($sql); $a = $v['Tables_in_'.$tatabase]; $b = _DB_PREFIX_; $bodytag = str_replace($b, $prefixt, $a); $liste = 'INSERT IGNORE INTO `'.$bodytag.'` VALUES <br />'; $c = $c1 = $id_customer; foreach ($ps as $k3 => $v3) { $liste .= '('; foreach ($v3 as $k4 => $v4) { if ($k4 == 'id_customer') { $c = $c+1; $v4 = $c ; } if ($k4 == 'id_address') { $c1 = $c1+1; $v4 = $c1 ; } $liste .= '"'.$v4.'",'; } $liste = substr($liste, 0, -1); $liste .= '),<br />'; } $liste = substr($liste, 0, -7); $liste .= ';'; echo $liste.'<br /><br />'; } if ($v['Tables_in_'.$tatabase] == _DB_PREFIX_.'customer') { $sql = 'SELECT * FROM '.$v['Tables_in_'.$tatabase].' WHERE id_customer NOT IN (0,1,2)'; $ps = Db::getInstance()->ExecuteS($sql); $a = $v['Tables_in_'.$tatabase]; $b = _DB_PREFIX_; $bodytag = str_replace($b, $prefixt, $a); $liste = 'INSERT IGNORE INTO `'.$bodytag.'` VALUES <br />'; $c = $c1 = $id_customer; foreach ($ps as $k3 => $v3) { $liste .= '('; foreach ($v3 as $k4 => $v4) { if ($k4 == 'id_customer') { $c = $c+1; $v4 = $c ; } $liste .= '"'.$v4.'",'; } $liste = substr($liste, 0, -1); $liste .= '),<br />'; } $liste = substr($liste, 0, -7); $liste .= ';'; echo $liste.'<br /><br />'; } if ($v['Tables_in_'.$tatabase] == _DB_PREFIX_.'customer_group') { $sql = 'SELECT * FROM '.$v['Tables_in_'.$tatabase].' WHERE id_customer NOT IN (0,1,2) AND id_group = 1'; $ps = Db::getInstance()->ExecuteS($sql); $a = $v['Tables_in_'.$tatabase]; $b = _DB_PREFIX_; $bodytag = str_replace($b, $prefixt, $a); $liste = 'INSERT IGNORE INTO `'.$bodytag.'` VALUES <br />'; $c = $c1 = $id_customer; foreach ($ps as $k3 => $v3) { $liste .= '('; foreach ($v3 as $k4 => $v4) { if ($k4 == 'id_customer') { $c = $c+1; $v4 = $c ; } $liste .= '"'.$v4.'",'; } $liste = substr($liste, 0, -1); $liste .= '),<br />'; } $liste = substr($liste, 0, -7); $liste .= ';'; echo $liste.'<br /><br />'; } } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.67 / 8
57 Votes
http://codebin.yi.org/887
page generated in 0.00 seconds