Project Detail

Script modification  

Script modification is project number 280662
posted at GetAFreelancer.com. Click here to post your own project.

 

Bookmark and Share
Free Trial For New Buyers
 

Status: Closed
(Cancelled by Service Buyer)

Selected Providers: -

Budget: $30-250

Created: 06/29/2008 at 13:02 EDT

Bid Count: 0

Average Bid: -

06/30/2008 at 13:02 EDT

Project Creator: stretchcomms View PM Post PM
Employer Rating: 9.98/109.98/109.98/109.98/109.98/109.98/109.98/109.98/109.98/109.98/10 (45 reviews)

Bid On This Project
 

Description

This is a very simple $10 project:

Just need a very simple script modification. Script downloads data from our database making changes to content / replace text on download.

I need to add a section where it will automatically remove any from the database (so for example the name OConnor becomes OConnor.

I try to do
switch ($row['vLastName']) {
case '' :
$row['vLastName'] = '';
break;
case "0-0-0": $row['vLastName'] = "00/00/00";
}

but because is code, it causes syntax error.

Need a quick fix... Full script below.

$where = '';
if($_POST['vPTitle'] != '')
$where .= 'and vPTitle LIKE '%'.$_POST['vPTitle'].'%' ';
if($_POST['answer'] != '')
$where .= 'and vCAnswer LIKE '%'.$_POST['vCAnswer'].'%' ';
if($_POST['start'] != '' && $_POST['end'] != ''){
$ar = explode('/',$_POST['start']);
$start = $ar[2].'/'. $ar[1].'/'. $ar[0];
$ar = explode('/',$_POST['end']);
$end = $ar[2].'/'. $ar[1].'/'. $ar[0];
$where .=" and dDate BETWEEN '".$start."' AND '".$end."' ";
}




$csv_output = '"TITLE","FIRST","LAST","ADDR1","TOWN","POSTCODE","DAYPHONE","MOBPHONE","EMAILADDR","DOB","GENDER","NI_EMAIL_PERMISSION","NI_SMS_PERMISSION","NI_POST_AND_PHONE_PERMISSION","TRD_PARTY_POST_AND_PHONE_PERMISSION","BUY_TIMES","SAT_TIMES","BUY_STIMES","CODE","RECENCYDAT"';
$csv_output .= "rn";
$result = mysql_query("SELECT * , DATE_FORMAT(dDate, '%d/%m/%Y') as register_date FROM promotion_user_2 WHERE iPromoUId > 0 $where ");
if(@mysql_num_rows($result) != 0){
while($row = mysql_fetch_assoc($result)) {
foreach($row as $ind => $val){
$row[$ind] = str_replace('"', '', $row[$ind] );
$row[$ind] = str_replace(',', ' ', $row[$ind] );
$row[$ind] = str_replace('s', 's', $row[$ind] );
}

switch ($row['vGender']) {
case 'Male' :
$row['vGender'] = 'm';
break;
case 'Fale' :
$row['vGender'] = 'f';
break;
default:
$row['vGender'] = 'u';
}

$row['eEmail'] = ($row['eEmail']== 'Yes' ? 3 : 4);
$row['eSMS'] = ($row['eSMS']== 'Yes' ? 3 : 4);
$row['eContactedByUs'] = ($row['eContactedByUs']== 'Yes' ? 4 : 3);
$row['eSelectedCompanies'] = ($row['eSelectedCompanies'] == 'Yes' ? 4 : 3);
switch ($row['vReadNewspapper']) {
case "1-3 TIMES PER WEEK": $row['vReadNewspapper'] = "QO";
break;
case "4-6 TIMES PER WEEK": $row['vReadNewspapper'] = "AA";
break;
case "LESS THAN ONCE A WEEK": $row['vReadNewspapper'] = "OO";
break;
case "NEVER": $row['vReadNewspapper'] = "NO";
break;
}
switch ($row['vReadOnSaturday']) {
case "1-2 TIMES PER MONTH": $row['vReadOnSaturday'] = 2;
break;
case "3-4 TIMES PER MONTH": $row['vReadOnSaturday'] = 4;
break;
case "LESS THAN ONCE A MONTH": $row['vReadOnSaturday'] = 2;
break;
case "NEVER": $row['vReadOnSaturday'] = 0;
break;
}
switch ($row['vReadOnSunday']) {
case "1-2 TIMES PER MONTH": $row['vReadOnSunday'] = "QO";
break;
case "3-4 TIMES PER MONTH": $row['vReadOnSunday'] = "AA";
break;
case "LESS THAN ONCE A MONTH": $row['vReadOnSunday'] = "OO";
break;
case "NEVER": $row['vReadOnSunday'] = "NO";
break;
}
switch ($row['dBirthDate']) {
case '-' :
$row['dBirthDate'] = '/';
break;
case "0-0-0": $row['dBirthDate'] = "00/00/00";
}
$csv_output .= '"'.$row['vTitle'].'","'.$row['vFirstName'].'","'.$row['vLastName'].'","'.$row['vHouseNo'].' '.$row['vStreet'].'","'.$row['vCity'].'","'.$row['vPinCode'].'","'.$row['vTelNo'].'","'.$row['vMobileNo'].'","'.$row['vEmail'].'","'.$row['dBirthDate'].'","'.$row['vGender'].'","'.$row['eEmail'].'","'.$row['eSMS'].'","'.$row['eContactedByUs'].'","'.$row['eSelectedCompanies'].'","'.$row['vReadNewspapper'].'","'.$row['vReadOnSaturday'].'","'.$row['vReadOnSunday'].'","'.$row['vPTitle'].'","'.$row['register_date'].'"';
$csv_output .= "rn";
}

$csv_output = str_replace("'", "", $csv_output);

header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=".date("Y-m-d")."_Promo2.csv");
print $csv_output;
exit;
} else {$err = 'No members were found with xcode "'.$_POST['vPTitle'].'" ';}
}
?>
<HTML>


Additional information submitted:

06/29/2008 at 13:11 EDT:
PLEASE SEE ATTACHED FILE FOR PROJECT DETAIL AS ABOVE IS INCORRECT.


Additional files submitted:
project.rtf

Messages Posted: 0 View project clarification board Post message on project clarification board

Bid On This Project
 
If you are the project creator or one of the bidders Log In for more options
Bids are hidden by the project creator. Log in as the project creator or as one of the bidders to view bids. You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.

    Bid on this Project