View Single Post
  #4  
Old November 22nd, 2011, 12:50 AM
seovisions seovisions is offline
 
Join Date: Sep 2011
Posts: 12
Default

perhaps you could add a delimiter. I am not entirely sure what you programmed everything in, nor how difficult it would be to add a delimiter.

Maybe a simple php explode on | would work along with a basic foreach with the SQL insert.

ie:
PHP Code:
$parent $_POST['parent'];
$add_category explode('|'$_POST['category_string']);

if(
count($add_category) > 0){

//multiple entries to add
foreach($add_category as $value){
try{
mysql_query("UPDATE table SET category = $value WHERE cat_parent = $parent );
}catch(Exception 
$e){
echo 'Exception caught: ',  
$e->getMessage(), "\n";
}

}

}else{

//it's a single entry
try{
mysql_query("
UPDATE table SET category $value WHERE cat_parent $parent );
}catch(
Exception $e){
echo 
'Exception caught: ',  $e->getMessage(), "\n";
}


You would, of course, fix it to fit the tables used, error checking, etc.