• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

chicosoft

Ajuda com variaveis

10 mensagens neste tópico

Viva, preciso de ajuda. ;)

Imaginem que tenho uma textbox, quero adicionar texto, numa coluna de sql, sem apagar o que la está, ou seja quero acrescentar nova informação.

Penso que seja simples, mas não estou a conseguir :wallbash:

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

assim acho que nao podes,

o que podes fazer e tirar o conteudo da coluna pra 1 variavel de php,

e depois com a query, adicionar todos os dados (os q la tavam, e os novos)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

como faço eu isso?

Não consigo é juntar as duas variaveis, e escreve-las na coluna.

Vou postar o codigo:

<?php 
session_start();
ob_start();
?>

<?php include ("ewconfig.php") ?>
<?php include ("db.php") ?>
<?php include ("entradasinfo.php") ?>
<?php include ("advsecu.php") ?>
<?php include ("phpmkrfn.php") ?>
<?php include ("ewupload.php") ?>
<?php
if (!IsLoggedIn() && (@$_COOKIE[ewCookieAutoLogin] == "autologin" && @$_COOKIE[ewCookiePassword] <> "")) {
ob_end_clean();
header("Location: login.php");
exit();
}
LoadUserLevel();
$ewCurSec = (IsLoggedIn())? CurrentUserLevelPriv("entradas") : GetAnonymousPriv("entradas");	
if (($ewCurSec & ewAllowEdit) <> ewAllowEdit) {
ob_end_clean();
header("Location: entradaslist.php");
exit();
}
?>
<?php

// Initialize common variables
$x_ID = NULL;
$ox_ID = NULL;
$z_ID = NULL;
$ar_x_ID = NULL;
$ari_x_ID = NULL;
$x_IDList = NULL;
$x_IDChk = NULL;
$cbo_x_ID_js = NULL;
$x_Status = NULL;
$ox_Status = NULL;
$z_Status = NULL;
$ar_x_Status = NULL;
$ari_x_Status = NULL;
$x_StatusList = NULL;
$x_StatusChk = NULL;
$cbo_x_Status_js = NULL;
$x_Subject = NULL;
$ox_Subject = NULL;
$z_Subject = NULL;
$ar_x_Subject = NULL;
$ari_x_Subject = NULL;
$x_SubjectList = NULL;
$x_SubjectChk = NULL;
$cbo_x_Subject_js = NULL;
$x_Department = NULL;
$ox_Department = NULL;
$z_Department = NULL;
$ar_x_Department = NULL;
$ari_x_Department = NULL;
$x_DepartmentList = NULL;
$x_DepartmentChk = NULL;
$cbo_x_Department_js = NULL;
$x_Submitter = NULL;
$ox_Submitter = NULL;
$z_Submitter = NULL;
$ar_x_Submitter = NULL;
$ari_x_Submitter = NULL;
$x_SubmitterList = NULL;
$x_SubmitterChk = NULL;
$cbo_x_Submitter_js = NULL;
$x_Assigned_To = NULL;
$ox_Assigned_To = NULL;
$z_Assigned_To = NULL;
$ar_x_Assigned_To = NULL;
$ari_x_Assigned_To = NULL;
$x_Assigned_ToList = NULL;
$x_Assigned_ToChk = NULL;
$cbo_x_Assigned_To_js = NULL;
$x_Site = NULL;
$ox_Site = NULL;
$z_Site = NULL;
$ar_x_Site = NULL;
$ari_x_Site = NULL;
$x_SiteList = NULL;
$x_SiteChk = NULL;
$cbo_x_Site_js = NULL;
$x_Fault_Type = NULL;
$ox_Fault_Type = NULL;
$z_Fault_Type = NULL;
$ar_x_Fault_Type = NULL;
$ari_x_Fault_Type = NULL;
$x_Fault_TypeList = NULL;
$x_Fault_TypeChk = NULL;
$cbo_x_Fault_Type_js = NULL;
$x_Alarm_Level = NULL;
$ox_Alarm_Level = NULL;
$z_Alarm_Level = NULL;
$ar_x_Alarm_Level = NULL;
$ari_x_Alarm_Level = NULL;
$x_Alarm_LevelList = NULL;
$x_Alarm_LevelChk = NULL;
$cbo_x_Alarm_Level_js = NULL;
$x_Network_Impact = NULL;
$ox_Network_Impact = NULL;
$z_Network_Impact = NULL;
$ar_x_Network_Impact = NULL;
$ari_x_Network_Impact = NULL;
$x_Network_ImpactList = NULL;
$x_Network_ImpactChk = NULL;
$cbo_x_Network_Impact_js = NULL;
$x_BTS_ON_AIR = NULL;
$ox_BTS_ON_AIR = NULL;
$z_BTS_ON_AIR = NULL;
$ar_x_BTS_ON_AIR = NULL;
$ari_x_BTS_ON_AIR = NULL;
$x_BTS_ON_AIRList = NULL;
$x_BTS_ON_AIRChk = NULL;
$cbo_x_BTS_ON_AIR_js = NULL;
$x_Provider = NULL;
$ox_Provider = NULL;
$z_Provider = NULL;
$ar_x_Provider = NULL;
$ari_x_Provider = NULL;
$x_ProviderList = NULL;
$x_ProviderChk = NULL;
$cbo_x_Provider_js = NULL;
$x_Provider_Reference = NULL;
$ox_Provider_Reference = NULL;
$z_Provider_Reference = NULL;
$ar_x_Provider_Reference = NULL;
$ari_x_Provider_Reference = NULL;
$x_Provider_ReferenceList = NULL;
$x_Provider_ReferenceChk = NULL;
$cbo_x_Provider_Reference_js = NULL;
$x_Client = NULL;
$ox_Client = NULL;
$z_Client = NULL;
$ar_x_Client = NULL;
$ari_x_Client = NULL;
$x_ClientList = NULL;
$x_ClientChk = NULL;
$cbo_x_Client_js = NULL;
$x_Detailed_Actions = NULL;
$ox_Detailed_Actions = NULL;
$z_Detailed_Actions = NULL;
$ar_x_Detailed_Actions = NULL;
$ari_x_Detailed_Actions = NULL;
$x_Detailed_ActionsList = NULL;
$x_Detailed_ActionsChk = NULL;
$cbo_x_Detailed_Actions_js = NULL;
$x_Detailed_Actions2 = NULL;
$x_Detailed_Actions3 = NULL;
$x_Create_Date = NULL;
$ox_Create_Date = NULL;
$z_Create_Date = NULL;
$ar_x_Create_Date = NULL;
$ari_x_Create_Date = NULL;
$x_Create_DateList = NULL;
$x_Create_DateChk = NULL;
$cbo_x_Create_Date_js = NULL;
$x_Modified_Date = NULL;
$ox_Modified_Date = NULL;
$z_Modified_Date = NULL;
$ar_x_Modified_Date = NULL;
$ari_x_Modified_Date = NULL;
$x_Modified_DateList = NULL;
$x_Modified_DateChk = NULL;
$cbo_x_Modified_Date_js = NULL;
$x_Close_Date = NULL;
$ox_Close_Date = NULL;
$z_Close_Date = NULL;
$ar_x_Close_Date = NULL;
$ari_x_Close_Date = NULL;
$x_Close_DateList = NULL;
$x_Close_DateChk = NULL;
$cbo_x_Close_Date_js = NULL;
$x_modifiedby = NULL;
$ox_modifiedby = NULL;
$z_modifiedby = NULL;
$ar_x_modifiedby = NULL;
$ari_x_modifiedby = NULL;
$x_modifiedbyList = NULL;
$x_modifiedbyChk = NULL;
$cbo_x_modifiedby_js = NULL;
?>
<?php

// Load key from QueryString
$x_ID = @$_GET["ID"];

// Get action
$sAction = @$_POST["a_edit"];
if ($sAction == "") {
$sAction = "I";	// Display record	
} else {

// Get fields from form
$x_ID = @$_POST["x_ID"];
$x_Status = @$_POST["x_Status"];
$x_Subject = @$_POST["x_Subject"];
$x_Department = @$_POST["x_Department"];
$x_Submitter = @$_POST["x_Submitter"];
$x_Assigned_To = @$_POST["x_Assigned_To"];
$x_Site = @$_POST["x_Site"];
$x_Fault_Type = @$_POST["x_Fault_Type"];
$x_Alarm_Level = @$_POST["x_Alarm_Level"];
$x_Network_Impact = @$_POST["x_Network_Impact"];
$x_BTS_ON_AIR = @$_POST["x_BTS_ON_AIR"];
$x_Provider = @$_POST["x_Provider"];
$x_Provider_Reference = @$_POST["x_Provider_Reference"];
$x_Client = @$_POST["x_Client"];
$x_Detailed_Actions = @$_POST["x_Detailed_Actions"];
$x_Create_Date = @$_POST["x_Create_Date"];
$x_Modified_Date = @$_POST["x_Modified_Date"];
$x_Close_Date = @$_POST["x_Close_Date"];
$x_modifiedby = @$_POST["x_modifiedby"];
}
if (($x_ID == "") || (is_null($x_ID))) {
ob_end_clean();
header("Location: entradaslist.php");
exit();
}
$conn = phpmkr_db_connect(HOST, USER, PASS, DB, PORT);
switch ($sAction) {
case "I": // Display record
	if (!LoadData($conn)) { // Load record
		$_SESSION[ewSessionMessage] = "No records found";
		phpmkr_db_close($conn);
		ob_end_clean();
		header("Location: entradaslist.php");
		exit();
	}
	break;
case "U": // Update
	if (EditData($conn)) { // Update record
		$_SESSION[ewSessionMessage] = "Update Record Successful";
		phpmkr_db_close($conn);
		ob_end_clean();
		header("Location: entradaslist.php");
		exit();
	}
	break;
}
?>
<?php include ("header.php") ?>
<script type="text/javascript">
<!--
EW_LookupFn = "ewlookup.php"; // ewlookup file name
EW_AddOptFn = "ewaddopt.php"; // ewaddopt.php file name
EW_MultiPagePage = "Page"; // multi-page Page Text
EW_MultiPageOf = "of"; // multi-page Of Text

//-->
</script>
<script type="text/javascript" src="ewp.js"></script>
<script type="text/javascript">
<!--
EW_dateSep = "/"; // set date separator	

//-->
</script>
<script type="text/javascript">
<!--
function EW_checkMyForm(EW_this) {
if (EW_this.x_Status && !EW_hasValue(EW_this.x_Status, "RADIO" )) {
if (!EW_onError(EW_this, EW_this.x_Status, "RADIO", "Please enter required field - Status"))
	return false;
}
if (EW_this.x_Subject && !EW_hasValue(EW_this.x_Subject, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_Subject, "TEXT", "Please enter required field - Subject"))
	return false;
}
if (EW_this.x_Department && !EW_hasValue(EW_this.x_Department, "SELECT" )) {
if (!EW_onError(EW_this, EW_this.x_Department, "SELECT", "Please enter required field - Department"))
	return false;
}
if (EW_this.x_Submitter && !EW_hasValue(EW_this.x_Submitter, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_Submitter, "TEXT", "Please enter required field - Submitter"))
	return false;
}
if (EW_this.x_Assigned_To && !EW_hasValue(EW_this.x_Assigned_To, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_Assigned_To, "TEXT", "Please enter required field - Assigned To"))
	return false;
}
if (EW_this.x_Site && !EW_hasValue(EW_this.x_Site, "SELECT" )) {
if (!EW_onError(EW_this, EW_this.x_Site, "SELECT", "Please enter required field - Site"))
	return false;
}
if (EW_this.x_Fault_Type && !EW_hasValue(EW_this.x_Fault_Type, "SELECT" )) {
if (!EW_onError(EW_this, EW_this.x_Fault_Type, "SELECT", "Please enter required field - Fault Type"))
	return false;
}
if (EW_this.x_Alarm_Level && !EW_hasValue(EW_this.x_Alarm_Level, "RADIO" )) {
if (!EW_onError(EW_this, EW_this.x_Alarm_Level, "RADIO", "Please enter required field - Alarm Level"))
	return false;
}
if (EW_this.x_Network_Impact && !EW_hasValue(EW_this.x_Network_Impact, "RADIO" )) {
if (!EW_onError(EW_this, EW_this.x_Network_Impact, "RADIO", "Please enter required field - Network Impact"))
	return false;
}
if (EW_this.x_BTS_ON_AIR && !EW_hasValue(EW_this.x_BTS_ON_AIR, "RADIO" )) {
if (!EW_onError(EW_this, EW_this.x_BTS_ON_AIR, "RADIO", "Please enter required field - BTS ON AIR"))
	return false;
}
if (EW_this.x_Provider && !EW_hasValue(EW_this.x_Provider, "SELECT" )) {
if (!EW_onError(EW_this, EW_this.x_Provider, "SELECT", "Please enter required field - Provider"))
	return false;
}
if (EW_this.x_Provider_Reference && !EW_hasValue(EW_this.x_Provider_Reference, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_Provider_Reference, "TEXT", "Please enter required field - Provider Reference"))
	return false;
}
if (EW_this.x_Client && !EW_hasValue(EW_this.x_Client, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_Client, "TEXT", "Please enter required field - Client"))
	return false;
}
if (EW_this.x_Detailed_Actions && !EW_hasValue(EW_this.x_Detailed_Actions, "TEXTAREA" )) {
if (!EW_onError(EW_this, EW_this.x_Detailed_Actions, "TEXTAREA", "Please enter required field - Detailed Actions"))
	return false;
}
return true;
}

//-->
</script>
<script type="text/javascript">
<!--
var EW_DHTMLEditors = [];

//-->
</script>
<p><span class="phpmaker">Edit TABLE: entradas<br><br><a href="entradaslist.php">Back to List</a></span></p>
<form name="fentradasedit" id="fentradasedit" action="entradasedit.php" method="post" onSubmit="return EW_checkMyForm(this);">
<p>
<input type="hidden" name="a_edit" value="U">
<?php
if (@$_SESSION[ewSessionMessage] <> "") {
?>
<p><span class="ewmsg"><?php echo $_SESSION[ewSessionMessage]; ?></span></p>
<?php
$_SESSION[ewSessionMessage] = ""; // Clear message
}
?>
<table class="ewTable">
	<tr id="r_ID">
		<td class="ewTableHeader"><span>Request ID</span></td>
		<td class="ewTableAltRow"><span id="cb_x_ID">
<?php echo $x_ID; ?><input type="hidden" id="x_ID" name="x_ID" value="<?php echo @$x_ID; ?>">
</span></td>
	</tr>
	<tr id="r_Status">
		<td class="ewTableHeader"><span>Status<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Status">
<?php echo RenderControl(4, 0, 5, 1); ?>
<input type="radio" name="x_Status"<?php if (@$x_Status == "New") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("New"); ?>">
<?php echo "New"; ?>
<?php echo RenderControl(4, 0, 5, 2); ?>
<?php echo RenderControl(4, 1, 5, 1); ?>
<input type="radio" name="x_Status"<?php if (@$x_Status == "Assigned") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Assigned"); ?>">
<?php echo "Assigned"; ?>
<?php echo RenderControl(4, 1, 5, 2); ?>
<?php echo RenderControl(4, 2, 5, 1); ?>
<input type="radio" name="x_Status"<?php if (@$x_Status == "Fixed") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Fixed"); ?>">
<?php echo "Fixed"; ?>
<?php echo RenderControl(4, 2, 5, 2); ?>
<?php echo RenderControl(4, 3, 5, 1); ?>
<input type="radio" name="x_Status"<?php if (@$x_Status == "Rejected") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Rejected"); ?>">
<?php echo "Rejected"; ?>
<?php echo RenderControl(4, 3, 5, 2); ?>
<?php echo RenderControl(4, 4, 5, 1); ?>
<input type="radio" name="x_Status"<?php if (@$x_Status == "Closed") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Closed"); ?>">
<?php echo "Closed"; ?>
<?php echo RenderControl(4, 4, 5, 2); ?>
</span></td>
	</tr>
	<tr id="r_Subject">
		<td class="ewTableHeader"><span>Subject<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Subject">
<input type="text" name="x_Subject" id="x_Subject" size="30" maxlength="28" value="<?php echo htmlspecialchars(@$x_Subject) ?>">
</span></td>
	</tr>
	<tr id="r_Department">
		<td class="ewTableHeader"><span>Department<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Department">
<?php
$x_DepartmentList = "<select id='x_Department' name='x_Department'>";
$x_DepartmentList .= "<option value=''>Please Select</option>";
$sSqlWrk = "SELECT `Department`, `Department` FROM `department`";
$sSqlWrk .= " ORDER BY `Department` Asc";
$rswrk = phpmkr_query($sSqlWrk,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL:' . $sSqlWrk);
if ($rswrk) {
$rowcntwrk = 0;
while ($datawrk = phpmkr_fetch_array($rswrk)) {
	$x_DepartmentList .= "<option value=\"" . htmlspecialchars($datawrk[0]) . "\"";
	if ($datawrk["Department"] == @$x_Department) {
		$x_DepartmentList .= " selected";
	}
	$x_DepartmentList .= ">" . $datawrk["Department"] . "</option>";
	$rowcntwrk++;
}
}
@phpmkr_free_result($rswrk);
$x_DepartmentList .= "</select>";
echo $x_DepartmentList;
?>
</span></td>
	</tr>
	<tr id="r_Submitter">
		<td class="ewTableHeader"><span>Submitter<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Submitter">
<?php echo $x_Submitter; ?><input type="hidden" id="x_Submitter" name="x_Submitter" value="<?php echo @$x_Submitter; ?>">
</span></td>
	</tr>
	<tr id="r_Assigned_To">
		<td class="ewTableHeader"><span>Assigned To<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Assigned_To">
<input type="text" name="x_Assigned_To" id="x_Assigned_To" size="30" maxlength="28" value="<?php echo htmlspecialchars(@$x_Assigned_To) ?>">
</span></td>
	</tr>
	<tr id="r_Site">
		<td class="ewTableHeader"><span>Site<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Site">
<?php
$x_SiteList = "<select id='x_Site' name='x_Site'>";
$x_SiteList .= "<option value=''>Please Select</option>";
$sSqlWrk = "SELECT `BTSNAME`, `BTSNAME` FROM `bts`";
$sSqlWrk .= " ORDER BY `BTSNAME` Asc";
$rswrk = phpmkr_query($sSqlWrk,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL:' . $sSqlWrk);
if ($rswrk) {
$rowcntwrk = 0;
while ($datawrk = phpmkr_fetch_array($rswrk)) {
	$x_SiteList .= "<option value=\"" . htmlspecialchars($datawrk[0]) . "\"";
	if ($datawrk["BTSNAME"] == @$x_Site) {
		$x_SiteList .= " selected";
	}
	$x_SiteList .= ">" . $datawrk["BTSNAME"] . "</option>";
	$rowcntwrk++;
}
}
@phpmkr_free_result($rswrk);
$x_SiteList .= "</select>";
echo $x_SiteList;
?>
</span></td>
	</tr>
	<tr id="r_Fault_Type">
		<td class="ewTableHeader"><span>Fault Type<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Fault_Type">
<?php
$x_Fault_TypeList = "<select id='x_Fault_Type' name='x_Fault_Type'>";
$x_Fault_TypeList .= "<option value=''>Please Select</option>";
$sSqlWrk = "SELECT `faulttype`, `faulttype` FROM `fault`";
$sSqlWrk .= " ORDER BY `faulttype` Asc";
$rswrk = phpmkr_query($sSqlWrk,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL:' . $sSqlWrk);
if ($rswrk) {
$rowcntwrk = 0;
while ($datawrk = phpmkr_fetch_array($rswrk)) {
	$x_Fault_TypeList .= "<option value=\"" . htmlspecialchars($datawrk[0]) . "\"";
	if ($datawrk["faulttype"] == @$x_Fault_Type) {
		$x_Fault_TypeList .= " selected";
	}
	$x_Fault_TypeList .= ">" . $datawrk["faulttype"] . "</option>";
	$rowcntwrk++;
}
}
@phpmkr_free_result($rswrk);
$x_Fault_TypeList .= "</select>";
echo $x_Fault_TypeList;
?>
</span></td>
	</tr>
	<tr id="r_Alarm_Level">
		<td class="ewTableHeader"><span>Alarm Level<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Alarm_Level">
<?php echo RenderControl(3, 0, 5, 1); ?>
<input type="radio" name="x_Alarm_Level"<?php if (@$x_Alarm_Level == "Critical") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Critical"); ?>">
<?php echo "Critical"; ?>
<?php echo RenderControl(3, 0, 5, 2); ?>
<?php echo RenderControl(3, 1, 5, 1); ?>
<input type="radio" name="x_Alarm_Level"<?php if (@$x_Alarm_Level == "Major") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Major"); ?>">
<?php echo "Major"; ?>
<?php echo RenderControl(3, 1, 5, 2); ?>
<?php echo RenderControl(3, 2, 5, 1); ?>
<input type="radio" name="x_Alarm_Level"<?php if (@$x_Alarm_Level == "Minor") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Minor"); ?>">
<?php echo "Minor"; ?>
<?php echo RenderControl(3, 2, 5, 2); ?>
<?php echo RenderControl(3, 3, 5, 1); ?>
<input type="radio" name="x_Alarm_Level"<?php if (@$x_Alarm_Level == "Warning") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Warning"); ?>">
<?php echo "Warning"; ?>
<?php echo RenderControl(3, 3, 5, 2); ?>
</span></td>
	</tr>
	<tr id="r_Network_Impact">
		<td class="ewTableHeader"><span>Network Impact<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Network_Impact">
<?php echo RenderControl(1, 0, 5, 1); ?>
<input type="radio" name="x_Network_Impact"<?php if (@$x_Network_Impact == "Yes") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Yes"); ?>">
<?php echo "Yes"; ?>
<?php echo RenderControl(1, 0, 5, 2); ?>
<?php echo RenderControl(1, 1, 5, 1); ?>
<input type="radio" name="x_Network_Impact"<?php if (@$x_Network_Impact == "No") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("No"); ?>">
<?php echo "No"; ?>
<?php echo RenderControl(1, 1, 5, 2); ?>
</span></td>
	</tr>
	<tr id="r_BTS_ON_AIR">
		<td class="ewTableHeader"><span>BTS ON AIR<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_BTS_ON_AIR">
<?php echo RenderControl(1, 0, 5, 1); ?>
<input type="radio" name="x_BTS_ON_AIR"<?php if (@$x_BTS_ON_AIR == "Yes") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("Yes"); ?>">
<?php echo "Yes"; ?>
<?php echo RenderControl(1, 0, 5, 2); ?>
<?php echo RenderControl(1, 1, 5, 1); ?>
<input type="radio" name="x_BTS_ON_AIR"<?php if (@$x_BTS_ON_AIR == "No") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("No"); ?>">
<?php echo "No"; ?>
<?php echo RenderControl(1, 1, 5, 2); ?>
</span></td>
	</tr>
	<tr id="r_Provider">
		<td class="ewTableHeader"><span>Provider<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Provider">
<?php
$x_ProviderList = "<select id='x_Provider' name='x_Provider'>";
$x_ProviderList .= "<option value=''>Please Select</option>";
$sSqlWrk = "SELECT `Provider`, `Provider` FROM `provider`";
$sSqlWrk .= " ORDER BY `Provider` Asc";
$rswrk = phpmkr_query($sSqlWrk,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL:' . $sSqlWrk);
if ($rswrk) {
$rowcntwrk = 0;
while ($datawrk = phpmkr_fetch_array($rswrk)) {
	$x_ProviderList .= "<option value=\"" . htmlspecialchars($datawrk[0]) . "\"";
	if ($datawrk["Provider"] == @$x_Provider) {
		$x_ProviderList .= " selected";
	}
	$x_ProviderList .= ">" . $datawrk["Provider"] . "</option>";
	$rowcntwrk++;
}
}
@phpmkr_free_result($rswrk);
$x_ProviderList .= "</select>";
echo $x_ProviderList;
?>
</span></td>
	</tr>
	<tr id="r_Provider_Reference">
		<td class="ewTableHeader"><span>Provider Reference<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Provider_Reference">
<input type="text" name="x_Provider_Reference" id="x_Provider_Reference" size="30" maxlength="28" value="<?php echo htmlspecialchars(@$x_Provider_Reference) ?>">
</span></td>
	</tr>
	<tr id="r_Client">
		<td class="ewTableHeader"><span>Client<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Client">
<input type="text" name="x_Client" id="x_Client" size="30" maxlength="45" value="<?php echo htmlspecialchars(@$x_Client) ?>">
</span></td>
	</tr>
	<tr id="r_Detailed_Actions">
		<td class="ewTableHeader"><span>Detailed Actions<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Detailed_Actions">
<textarea cols="50" rows="20" READONLY id="x_Detailed_Actions2" name="x_Detailed_Actions2"><?php echo @$x_Detailed_Actions2; ?></textarea>
<textarea cols="50" rows="20" id="x_Detailed_Actions" name="x_Detailed_Actions"><?php echo @$x_Detailed_Actions2; echo "\n \n"; ?><?php echo date("d-m-Y H:i:s "); echo $_SESSION[ewSessionUserName];echo "\n \n";?> </textarea>
</span></td>
	</tr>
<input type="hidden" id="x_Modified_Date" name="x_Modified_Date" value="<?php echo date("d-m-Y H:i:s"); ?>">
	<tr id="r_Close_Date">
		<td class="ewTableHeader"><span>Close Date</span></td>
		<td class="ewTableAltRow"><span id="cb_x_Close_Date">
<input type="text" name="x_Close_Date" id="x_Close_Date" size="30" maxlength="28" value="<?php echo htmlspecialchars(@$x_Close_Date) ?>">
</span></td>
	</tr>
	<tr id="r_modifiedby">
		<td class="ewTableHeader"><span>Last Modified BY</span></td>
		<td class="ewTableAltRow"><span id="cb_x_modifiedby">
<input type="text" READONLY id="x_modifiedby" name="x_modifiedby" value="<?php echo $_SESSION[ewSessionUserName]; ?>">
</span></td>
	</tr>
</table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="EDIT">
</form>
<?php include ("footer.php") ?>
<?php
phpmkr_db_close($conn);
?>
<?php

//-------------------------------------------------------------------------------
// Function LoadData
// - Variables setup: field variables

function LoadData($conn)
{
global $x_ID;
$sFilter = ewSqlKeyWhere;
if (!is_numeric($x_ID)) return false;
$x_ID =  (get_magic_quotes_gpc()) ? stripslashes($x_ID) : $x_ID;
$sFilter = str_replace("@ID", AdjustSql($x_ID), $sFilter); // Replace key value
$sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
$rs = phpmkr_query($sSql,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
if (phpmkr_num_rows($rs) == 0) {
	$bLoadData = false;
} else {
	$bLoadData = true;
	$row = phpmkr_fetch_array($rs);

	// Get the field contents
	$GLOBALS["x_ID"] = $row["ID"];
	$GLOBALS["x_Status"] = $row["Status"];
	$GLOBALS["x_Subject"] = $row["Subject"];
	$GLOBALS["x_Department"] = $row["Department"];
	$GLOBALS["x_Submitter"] = $row["Submitter"];
	$GLOBALS["x_Assigned_To"] = $row["Assigned To"];
	$GLOBALS["x_Site"] = $row["Site"];
	$GLOBALS["x_Fault_Type"] = $row["Fault Type"];
	$GLOBALS["x_Alarm_Level"] = $row["Alarm Level"];
	$GLOBALS["x_Network_Impact"] = $row["Network Impact"];
	$GLOBALS["x_BTS_ON_AIR"] = $row["BTS ON AIR"];
	$GLOBALS["x_Provider"] = $row["Provider"];
	$GLOBALS["x_Provider_Reference"] = $row["Provider Reference"];
	$GLOBALS["x_Client"] = $row["Client"];
	//$GLOBALS["x_Detailed_Actions"] = $row["Detailed Actions"];
      	$GLOBALS["x_Detailed_Actions2"] = $row["Detailed Actions"];
        $GLOBALS["x_Create_Date"] = $row["Create Date"];
	$GLOBALS["x_Modified_Date"] = $row["Modified Date"];
	$GLOBALS["x_Close_Date"] = $row["Close Date"];
	$GLOBALS["x_modifiedby"] = $row["modifiedby"];
}
phpmkr_free_result($rs);
return $bLoadData;
}
?>
<?php

//-------------------------------------------------------------------------------
// Function EditData
// - Variables used: field variables

function EditData($conn)
{
global $x_ID;
$sFilter = ewSqlKeyWhere;
if (!is_numeric($x_ID)) return false;
$sTmp =  (get_magic_quotes_gpc()) ? stripslashes($x_ID) : $x_ID;
$sFilter = str_replace("@ID", AdjustSql($sTmp), $sFilter); // Replace key value
$sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
$rs = phpmkr_query($sSql,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);

// Get old recordset
$oldrs = phpmkr_fetch_array($rs);
if (phpmkr_num_rows($rs) == 0) {
	return false; // Update Failed
} else {
	$x_ID = @$_POST["x_ID"];
	$x_Status = @$_POST["x_Status"];
	$x_Subject = @$_POST["x_Subject"];
	$x_Department = @$_POST["x_Department"];
	$x_Submitter = @$_POST["x_Submitter"];
	$x_Assigned_To = @$_POST["x_Assigned_To"];
	$x_Site = @$_POST["x_Site"];
	$x_Fault_Type = @$_POST["x_Fault_Type"];
	$x_Alarm_Level = @$_POST["x_Alarm_Level"];
	$x_Network_Impact = @$_POST["x_Network_Impact"];
	$x_BTS_ON_AIR = @$_POST["x_BTS_ON_AIR"];
	$x_Provider = @$_POST["x_Provider"];
	$x_Provider_Reference = @$_POST["x_Provider_Reference"];
	$x_Client = @$_POST["x_Client"];
	$x_Detailed_Actions = @$_POST["x_Detailed_Actions"];
	$x_Modified_Date = @$_POST["x_Modified_Date"];
	$x_Close_Date = @$_POST["x_Close_Date"];
	$x_modifiedby = @$_POST["x_modifiedby"];
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Status"]) : $GLOBALS["x_Status"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Status`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Subject"]) : $GLOBALS["x_Subject"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Subject`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Department"]) : $GLOBALS["x_Department"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Department`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Submitter"]) : $GLOBALS["x_Submitter"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Submitter`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Assigned_To"]) : $GLOBALS["x_Assigned_To"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Assigned To`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Site"]) : $GLOBALS["x_Site"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Site`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Fault_Type"]) : $GLOBALS["x_Fault_Type"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Fault Type`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Alarm_Level"]) : $GLOBALS["x_Alarm_Level"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Alarm Level`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Network_Impact"]) : $GLOBALS["x_Network_Impact"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Network Impact`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_BTS_ON_AIR"]) : $GLOBALS["x_BTS_ON_AIR"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`BTS ON AIR`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Provider"]) : $GLOBALS["x_Provider"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Provider`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Provider_Reference"]) : $GLOBALS["x_Provider_Reference"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Provider Reference`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Client"]) : $GLOBALS["x_Client"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Client`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Detailed_Actions"]) : $GLOBALS["x_Detailed_Actions"];
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Detailed Actions`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Modified_Date"]) : $GLOBALS["x_Modified_Date"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Modified Date`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_Close_Date"]) : $GLOBALS["x_Close_Date"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`Close Date`"] = $theValue;
	$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_modifiedby"]) : $GLOBALS["x_modifiedby"]; 
	$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
	$fieldList["`modifiedby`"] = $theValue;

	// Updating event
	if (Recordset_Updating($fieldList, $oldrs)) {

		// Update
		$sSql = "UPDATE `entradas` SET ";
		foreach ($fieldList as $key=>$temp) {
			$sSql .= "$key = $temp, ";
		}
		if (substr($sSql, -2) == ", ") {
			$sSql = substr($sSql, 0, strlen($sSql)-2);
		}
		$sSql .= " WHERE " . $sFilter;
		phpmkr_query($sSql,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
		$result = (phpmkr_affected_rows($conn) >= 0);

		// Updated event
		if ($result) Recordset_Updated($fieldList, $oldrs);
	} else {
		$result = false; // Update Failed
	}
}
return $result;
}

// Updating Event
function Recordset_Updating($newrs, $oldrs)
{

// Enter your customized codes here
return true;
}

// Updated event
function Recordset_Updated($newrs, $oldrs)
{
$table = "entradas";
}
?>

O que quero é que ele adicione o x_Detailed_Actions2 ao x_Detailed_Actions...

O x_Detailed_Actions2 é o texto antigo. x_Detailed_Actions, é o texto que vou inserir...

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

primeiro, começa a postar o codigo k importa e não o ficheiro o todo... eu falo por mim, ms axo k pouca gente tem paciência para ler esse codigo todo...

depois, podes fazer como o karva te disse... pa concatenares variaveia fazes tipo

$var1= "blabla";

$var2= "bleble";

$var3 = $var1.$var2; (= "blablableble")

Não tenho a certeza se isto funciona, ms podes exprimentar:

UPDATE nome_da_tabela SET nome_do_campo = nome_do_campo+'$variavel_com_novo_conteudo'

No caso de serem campos numericos, ele soma-os, n sei como sera no caso de texto...

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Ai está... não consigo fazer isso, pesquisei no google, teoricamente é assim que se faz, mashá qualquer coisa a falhar, consegues olhar para o codigo e dizer-me o que está mal?

;)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Quando acessas o site mostra algum erro ? se a resposta é sim então posta aqui esse erro para que eu te possa ajudar porque não tenho paciencia de ler este código todo.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

não não da erro nehum...

Simplesmente quando faço add, so adiciona o novo texto apagando o antigo.

O codigo mais simplificado:

<tr id="r_Detailed_Actions">
		<td class="ewTableHeader"><span>Detailed Actions<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Detailed_Actions">
<textarea cols="50" rows="20" READONLY id="x_Detailed_Actions2" name="x_Detailed_Actions2"><?php echo @$x_Detailed_Actions2; ?></textarea>
<textarea cols="50" rows="20" id="x_Detailed_Actions" name="x_Detailed_Actions"><?php echo "\n \n"; ?><?php echo date("d-m-Y H:i:s "); echo $_SESSION[ewSessionUserName];echo "\n \n";?> </textarea>
</span></td>

como é que adiciono o x_Detailed_Actions2, x_Detailed_Actions??

x_Detailed_Actions2 é o texto antigo.

x_Detailed_Actions é o texto novo a adicionar.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Nao tive tempo pra ler o teu código todo, mas assim vai funcionar:

1 - tens o formulário com o texto e fazes POST

2 - $x_Detailed_Actions2 = ____ (aqui fazes um query para ir buscar o texto antigo)

3 - $x_Detailed_Actions = $_POST (aqui vais buscar o texto)

4 - $escrever = "$x_Detailed_Actions2" .

"$x_Detailed_Actions";

5 - Fazes update na BD com a variavel $escrever

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Não estou a conseguir... e ja tentei tudo :P

Será por o x_detailed_actions2, ser READONLY, e ele não assumir o mesmo? acho estranho...

Aqui está o codigo mais ou menos descomplicado que dei a coisa... :-[

		


<?php

// Initialize common variables




$x_Detailed_Actions = NULL;
$x_Detailed_Actions2 = NULL;
$escrever = NULL; 

?>
$sAction = @$_POST["a_edit"];
if ($sAction == "") {
$sAction = "I";	// Display record	
} else {

$x_Detailed_Actions = @$_POST["x_Detailed_Actions"];
$x_Detailed_Actions2 = @$_POST["x_Detailed_Actions2"];
                      $escrever = "$x_Detailed_Actions2" . "$x_Detailed_Actions";

}

<tr id="r_Detailed_Actions">
		<td class="ewTableHeader"><span>Detailed Actions<span class='ewmsg'> *</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Detailed_Actions">
<textarea style="color: black; background-color: #D0D0D0;" cols="50" rows="20" READONLY id="x_Detailed_Actions2" name="x_Detailed_Actions2"><?php echo @$x_Detailed_Actions2; echo "\n \n"; echo date("d-m-Y H:i:s "); echo $_SESSION[ewSessionUserName];echo "\n \n";?></textarea>
<textarea cols="50" rows="20" id="x_Detailed_Actions" name="x_Detailed_Actions"> </textarea>
</span></td>
	</tr>


{
global $x_ID;
$sFilter = ewSqlKeyWhere;
if (!is_numeric($x_ID)) return false;
$x_ID =  (get_magic_quotes_gpc()) ? stripslashes($x_ID) : $x_ID;
$sFilter = str_replace("@ID", AdjustSql($x_ID), $sFilter); // Replace key value
$sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
$rs = phpmkr_query($sSql,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
if (phpmkr_num_rows($rs) == 0) {
	$bLoadData = false;
} else {
	$bLoadData = true;
	$row = phpmkr_fetch_array($rs);


      	$GLOBALS["x_Detailed_Actions2"] = $row["Detailed Actions"];
        	}
phpmkr_free_result($rs);
return $bLoadData;
}



0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

<script language="php">

//obtens o novo texto

$x_Detailed_Actions2=$_POST["x_Detailed_Actions2"];

//de seguida obtens o texto antigo

//altera isto abaixo para ir buscar correctamente os dados à BD

//atenção ao $dbh no final... altera para a variável que tiveres criado na ligação

$result = mysql_query("SELECT x FROM table", $dbh);

//atribuis uma variavel $x_Detailed_Actions ao texto antigo

$x_Detailed_Actions=$query[0];

//aqui vais concatenar os dois

$escrever = "$x_Detailed_Actions2"

."$x_Detailed_Actions";

//fazes update na base de dados

mysql_query("UPDATE table SET x='$escrever' WHERE id='qq coisa q identifique a linha onde vais escrever' ", $dbh);

//testa só com este codigo antes de complicares com as verificações... o erro pode surgir aí

</script>

Assim deve dar

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!


Registar nova conta

Entra

Já tem conta? Inicie sessão aqui.


Entrar Agora