•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 330,298 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,830 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
I wont describe whats here, just figure it out yerself, enjoy =)
Last edited : Mar 27th, 2008.
// Mass Language Manager function SaveAll() { // adding $_REQUEST['val'] = array_unique($_REQUEST['val']); foreach ($_REQUEST['val'] as $key => $keyValue) { if (!$keyValue OR !strlen(join('',$_REQUEST['new'][$key]))) continue; if (!($keyValue = alnum($keyValue))) continue; if (mb_strlen($keyValue)>25 OR $this->checkForKey($keyValue)) continue; foreach ($_REQUEST['new'] as $i => $arrLangVal) { foreach ($arrLangVal as $lang => $value) { if ($value) { $_REQUEST['new'][$i][$lang] = addslashes($value); } else { foreach ($arrLangVal as $l => $v) { if ($arrLangVal[$l]) { $_REQUEST['new'][$i][$lang] = addslashes($v); } } } } } $strSql = 'INSERT INTO '.$this->strTable.' (val, '.join(',',array_keys($_REQUEST['new'][$key])).') VALUES (\''.$keyValue.'\', \''.join('\',\'',array_values($_REQUEST['new'][$key])).'\')'; $this->objDB->query($strSql); } // deleting $delArr = array(); if (count($_REQUEST['del'])) { foreach ($_REQUEST['del'] as $keyVal => $Y) { if ($Y!='Y') continue; $delArr[] = $keyVal; $strSql = 'DELETE FROM '.$this->strTable.' WHERE val=\''.$keyVal.'\''; $this->objDB->query($strSql); } } // updating if (!count($_REQUEST['old'])) return; foreach ($_REQUEST['old'] as $keyValue => $arrLangVal) { if (in_array($keyValue,$delArr) OR !strlen(join('',$_REQUEST['old'][$keyValue]))) continue; $arrUpdateValues = array(); foreach ($arrLangVal as $lang => $value) { if ($value) { $arrUpdateValues[] = $lang.'=\''.addslashes($value).'\''; } else { foreach ($arrLangVal as $lang => $value) { if ($arrLangVal[$lang]) { $arrUpdateValues[] = $lang.'=\''.addslashes($value).'\''; } } } } $strSql = 'UPDATE '.$this->strTable.' SET '.join(',',$arrUpdateValues).' WHERE val = \''.$keyValue.'\''; $this->objDB->query($strSql); } }
Comments (Newest First)
nav33n | Nearly a Posting Maven | Dec 11th, 2007
•
•
•
•
Sorry ! What does this code snippet do btw ?
cscgal | The Queen of DaniWeb | Dec 2nd, 2007
•
•
•
•
I don't get it? ... and I'm a PHP programmer. It looks like the function is part of a class that you aren't showing us. What are we saving??
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)