Devam Ediyor

512420 php update

Currently we need part of our existing website updated so it pulls info such as categories out of the database rather than it being hard coded. Half the website updates categories and locations from the database whilst other parts do not. For example this is the hard coded part we need changing:

function editDetails($ch1, $ch2, $ch3, $ch4, $ch5, $ch6, $ch7, $ch8, $ch9, $ch10, $ch11, $ch12, $ch13, $ch14, $ch15, $ch16, $ch17, $ch18, $ch19, $ch20, $ch21, $ch22, $ch23, $ch24, $ch25, $ch26, $ch27, $ch28) {

global $database, $form;

isset($ch1) ? $database->updateDetailsField($this->username, "job_category1", "1") : $database->updateDetailsField($this->username, "job_category1", "0");

isset($ch2) ? $database->updateDetailsField($this->username, "job_category2", "1") : $database->updateDetailsField($this->username, "job_category2", "0");

isset($ch3) ? $database->updateDetailsField($this->username, "job_category3", "1") : $database->updateDetailsField($this->username, "job_category3", "0");

isset($ch4) ? $database->updateDetailsField($this->username, "job_category4", "1") : $database->updateDetailsField($this->username, "job_category4", "0");

isset($ch5) ? $database->updateDetailsField($this->username, "job_category5", "1") : $database->updateDetailsField($this->username, "job_category5", "0");

isset($ch6) ? $database->updateDetailsField($this->username, "job_category6", "1") : $database->updateDetailsField($this->username, "job_category6", "0");

isset($ch7) ? $database->updateDetailsField($this->username, "job_category7", "1") : $database->updateDetailsField($this->username, "job_category7", "0");

isset($ch8) ? $database->updateDetailsField($this->username, "job_category8", "1") : $database->updateDetailsField($this->username, "job_category8", "0");

isset($ch9) ? $database->updateDetailsField($this->username, "job_category9", "1") : $database->updateDetailsField($this->username, "job_category9", "0");

isset($ch10) ? $database->updateDetailsField($this->username, "job_category10", "1") : $database->updateDetailsField($this->username, "job_category10", "0");

isset($ch11) ? $database->updateDetailsField($this->username, "job_sector1", "1") : $database->updateDetailsField($this->username, "job_sector1", "0");

isset($ch12) ? $database->updateDetailsField($this->username, "job_sector2", "1") : $database->updateDetailsField($this->username, "job_sector2", "0");

isset($ch13) ? $database->updateDetailsField($this->username, "job_sector3", "1") : $database->updateDetailsField($this->username, "job_sector3", "0");

isset($ch14) ? $database->updateDetailsField($this->username, "job_sector4", "1") : $database->updateDetailsField($this->username, "job_sector4", "0");

isset($ch15) ? $database->updateDetailsField($this->username, "job_sector5", "1") : $database->updateDetailsField($this->username, "job_sector5", "0");

isset($ch16) ? $database->updateDetailsField($this->username, "job_sector6", "1") : $database->updateDetailsField($this->username, "job_sector6", "0");

isset($ch17) ? $database->updateDetailsField($this->username, "job_sector7", "1") : $database->updateDetailsField($this->username, "job_sector7", "0");

isset($ch18) ? $database->updateDetailsField($this->username, "job_sector8", "1") : $database->updateDetailsField($this->username, "job_sector8", "0");

isset($ch19) ? $database->updateDetailsField($this->username, "job_location1", "1") : $database->updateDetailsField($this->username, "job_location1", "0");

isset($ch20) ? $database->updateDetailsField($this->username, "job_location2", "1") : $database->updateDetailsField($this->username, "job_location2", "0");

isset($ch21) ? $database->updateDetailsField($this->username, "job_location3", "1") : $database->updateDetailsField($this->username, "job_location3", "0");

isset($ch22) ? $database->updateDetailsField($this->username, "job_location4", "1") : $database->updateDetailsField($this->username, "job_location4", "0");

isset($ch23) ? $database->updateDetailsField($this->username, "job_location5", "1") : $database->updateDetailsField($this->username, "job_location5", "0");

isset($ch24) ? $database->updateDetailsField($this->username, "job_location6", "1") : $database->updateDetailsField($this->username, "job_location6", "0");

isset($ch25) ? $database->updateDetailsField($this->username, "job_type1", "1") : $database->updateDetailsField($this->username, "job_type1", "0");

isset($ch26) ? $database->updateDetailsField($this->username, "job_type2", "1") : $database->updateDetailsField($this->username, "job_type2", "0");

isset($ch27) ? $database->updateDetailsField($this->username, "job_type3", "1") : $database->updateDetailsField($this->username, "job_type3", "0");

isset($ch28) ? $database->updateDetailsField($this->username, "job_type4", "1") : $database->updateDetailsField($this->username, "job_type4", "0");

isset($ch25) ? $database->updateDetailsField($this->username, "job_type1", "1") : $database->updateDetailsField($this->username, "job_type1", "0");

$q2 = "INSERT INTO user_details(`username`, `job_category1`, `job_category2`, `job_category3`, `job_category4`, `job_category5`, `job_category6`, `job_category7`, `job_category8`, `job_category9`, `job_category10`, `job_sector1`, `job_sector2`, `job_sector3`, `job_sector4`, `job_sector5`, `job_sector6`, `job_sector7`, `job_sector8`, `job_location1`, `job_location2`, `job_location3`, `job_location4`, `job_location5`, `job_location6`, `job_type1`, `job_type2`, `job_type3`, `salary_from`, `salary_to`, `cv_path`, `cover_letter`) VALUES('$username', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";

<input name="ch1" type="checkbox" value="Residential" <?php if($database->getDetailsField($session->username, "job_category1") == "1") { echo "checked=\"checked\""; }?> />

<input name="ch2" type="checkbox" value="Commercial" <?php if($database->getDetailsField($session->username, "job_category2") == "1") { echo "checked=\"checked\""; }?> />

Here is an example of how we pull categories out of the database on other parts of the website:

<?php

$query = "SELECT name, id FROM category";

$res = mysql_query($query) or die(mysql_error());

while($a = mysql_fetch_array($res)) {

echo "<option value="."".$a[1].""."".((isset ($_GET['categories']) && $_GET['categories'] == "".$a[1]."") || ($row['categories'] == "".$a[1]."") ? ' selected="selected"' : '').">".$a[0]."</option>";

}

?>

Beceriler: Her şey Kabul, MySQL, PHP

Daha fazlasını görün: session php, php checked checked, category php id, echo parts, residential or commercial, info update, mysql update checkbox, php insert select, mysql function update, mysql update values, update values mysql, mysql update function, mysql php example, need update existing website, php mysql database query, mysql insert update , option checkbox php, database selected row, php mysql website updates, select name, mysql update select query, php form update database, mysql query example, insert update form php, mysql php form database

İşveren Hakkında:
( 7 değerlendirme )

Proje NO: #2258352

Seçilen:

easycitor

Kindly Check PM.

0 gün içinde 55$ USD
(15 Değerlendirme)
4.3