A little advice needed
Posted: Thu Apr 17, 2008 10:48 am
Hi all,
Just wondering if anyone could give me a little advice on classes and if there could possibly be any issues with the folowing code
Thanks in advance
Just wondering if anyone could give me a little advice on classes and if there could possibly be any issues with the folowing code
Thanks in advance
Code: Select all
class companyManager {
//////////ADD COMPANY
function addCompany($postedParameters){
if(isset($postedParameters['companyLogo'])){
$target_path = '_company_logos/'.basename(strtolower($postedParameters['companyLogo']));
move_uploaded_file($postedParameters['companyLogo'], $target_path)
};//end if
foreach($postedParameters as $key => $value){
$tableColumns .= ''.$key.', ';
$tableValues .= ''.$value.', ';
};//end foreach
$tableColumns = strlen($tableColumns)-2};
$tableValues = strlen($tableValues)-2};
connectMySQL();
mysql_query("INSERT INTO companies ('$tableColumns') VALUES ('$tableValues')")or die(mysql_error());
echo '<meta http-equiv="refresh" content="0;URL=../" />';
};//end function
//////////UPDATE COMPANY
function updateCompany($postedParameters){
if(isset($postedParameters['companyLogo'])){
$target_path = '_company_logos/'.basename(strtolower($postedParameters['companyLogo']));
move_uploaded_file($postedParameters['companyLogo'], $target_path)
};//end if
foreach($postedParameters as $key => $value){
$queryString .= '''.$key.'' = ''.$value.'' ';
};//end foreach
connectMySQL();
mysql_query("UPDATE companies SET $queryString")or die(mysql_error());
echo '<meta http-equiv="refresh" content="0;URL=../" />';
};//end function
};//end class companyManager