Foros del Web » Programando para Internet » PHP »

update base de datos test pagina

Estas en el tema de update base de datos test pagina en el foro de PHP en Foros del Web. buenas he realizado un script que hace cálculos, y le hace update a la base de datos, el problema es que el código no me ...
  #1 (permalink)  
Antiguo 03/11/2011, 15:08
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
update base de datos test pagina

buenas he realizado un script que hace cálculos, y le hace update a la base de datos, el problema es que el código no me envía ni errores ni los datos. revisando puse errores a propósito el código se ejecuta y ve los errores hasta antes de llegar al update.
alguien me puede hacer el favor de testear

tendria que hacer lo siguientes pasos:

Registrarce;
loguearce;
Crear Personaje primera fase.

esta es la pagina:
http://genesis1.zxq.net

no les dejo el codigo ya que es bastante extenso: pero intentare dejarcelos:
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #2 (permalink)  
Antiguo 03/11/2011, 15:19
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

el loggin se ejecuta perfectamente, guardar variables el la cockies de inicio de sesión:

Código PHP:
$query mysql_query("SELECT id,username,password,ucheck,mcheck,GM FROM user WHERE username = '$username'") or die(mysql_error());
            
$row mysql_fetch_array($query);
            
$_SESSION["s_username"] = $row['username'];
            
$_SESSION['logueado'] = "si";
            
$_SESSION['usuario'] = $username;
            
$_SESSION['id'] = $row['id'];
            
$_SESSION['ucheck'] = $row['ucheck'];
            
$_SESSION['mcheck'] = $row['mcheck'];
            
$_SESSION['GM'] = $row['GM'];
            
header('refresh:3; url=/index.php');
            echo 
"<br> <br> <br> <br> <br>";
            echo 
"Inicio de Sesion Correcto!!"
luego al cumplirse el header no se envia a la pagina donde se crea el personaje. recupero la variable sesión con eta cabecera:

Código PHP:
<?php
//sesion.php (es el inicio o página de acceso)
@session_name('MI_SESION');
@
session_start();
?>
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #3 (permalink)  
Antiguo 03/11/2011, 15:21
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

luego de esto vamos código html que utilizo para recoger los datos:

PArte uno


Código HTML:
<form name="form1" method="post" id="form1" action="nchar.php" >
					<table class="t3" align="center">
						<tbody>
							<tr>
								<td colspan="3">
									<span>ATRIBUTOS</span>
								</td>
								<td colspan="6">
									<span>INFORMACIÓN DEL PERSONAJE</span>
								</td>
							</tr>
							<tr>
								<td>
									<label>
										<select id="pfrs" name="pfrs" size="1" onchange="calcula1(this.options.selectedIndex)">
											<option value="5">-50</option>
											<option value="6">-40</option>
											<option value="7">-30</option>
											<option value="8">-20</option>
											<option value="9">-10</option>
											<option value="10" selected="selected">0</option>
											<option value="11">10</option>
											<option value="12">20</option>
											<option value="13">30</option>
											<option value="14">45</option>
											<option value="15">60</option>
											<option value="16">80</option>
											<option value="17">100</option>
											<option value="18">125</option>
											<option value="19">150</option>
											<option value="20">200</option>
										</select>
									</label>
								</td>
								<td>
									<b>
										<span>Fuerza</span>
									</b>
								</td>
								<td>
									<label>
										<input type="text" name="frs" id="frs" value="10" maxlength="3" size="4" disabled="disabled"/>
									</label>
								</td>
								<td colspan="2">
									<b>
										<span>Nombre</span>
									</b>
								</td>
								<td colspan="2">
									<label>
										<input type="text" name="namepj" id="namepj" size="16" maxlength="16"/>
									</label>
								</td>
								<td>
									<b>
										<span>Apellido</span>
									</b>
								</td>
								<td style="width: 165px">
									<label>
										<input type="text" name="apellidopj" id="apellidopj" size="16" maxlength="16"/>
									</label>
								</td>
							</tr>
							<tr>
								<td>
									<label>
										<select id="pdes" name="pdes" size="1" onchange="calcula2(this.options.selectedIndex)">
											<option value="5">-50</option>
											<option value="6">-40</option>
											<option value="7">-30</option>
											<option value="8">-20</option>
											<option value="9">-10</option>
											<option value="10" selected="selected">0</option>
											<option value="11">10</option>
											<option value="12">20</option>
											<option value="13">30</option>
											<option value="14">45</option>
											<option value="15">60</option>
											<option value="16">80</option>
											<option value="17">100</option>
											<option value="18">125</option>
											<option value="19">150</option>
											<option value="20">200</option>
										</select>
									</label>
								</td>
								<td>
								   	<b>
								   		<span>Destreza</span>
								   	</b>
								</td>
								<td>
									<label>
										<input type="text" name="des" id="des" value="10" maxlength="3" size="4" disabled="disabled" onchange="Suma(this.value)"/>
									</label>
								</td>
								<td colspan="2">
								   	<b>
								   		<span>Raza</span>
									</b>
								</td>
								<td colspan="2">
									<label>
										<select id="raza" name="raza" size="1" onchange="redirect(this.options.selectedIndex)">
											<option selected="selected">--Escoja una Raza--</option>
											<option value="001">Humano</option>
											<option value="002">Argonauta</option>
											<option value="003">Enano</option>
											<option value="004">Arunos (Elfo)</option>
										</select>
									</label>
							   	</td>
								<td>
									<b>
										<span>Profesión</span>
									</b>
								</td>
								<td style="width: 165px">
									<label>
										<select id="prof" name="prof" size="1">
											<option selected="selected" value="">--Escoja una Profesión--</option>
											<option value="">Prof. Humanos</option>
											<option value="">Prof. Argonautas</option>
											<option value="">Prof. Enanos</option>
											<option value="">Prof. Arunos(Elfo)</option>
										</select>
									</label>
								</td>
							</tr>
							<tr>
								<td>
									<label>
										<select id="psab" name="psab" size="1" onchange="calcula3(this.options.selectedIndex)">
											<option value="5">-50</option>
											<option value="6">-40</option>
											<option value="7">-30</option>
											<option value="8">-20</option>
											<option value="9">-10</option>
											<option value="10" selected="selected">0</option>
											<option value="11">10</option>
											<option value="12">20</option>
											<option value="13">30</option>
											<option value="14">45</option>
											<option value="15">60</option>
											<option value="16">80</option>
											<option value="17">100</option>
											<option value="18">125</option>
											<option value="19">150</option>
											<option value="20">200</option>
										</select>
									</label>
								</td>
								<td>
									<b>
										<span>Saber</span>
									</b>
								</td>
								<td>
									<label>
										<input type="text" name="sab" id="sab" value="10" maxlength="3" size="4" disabled="disabled" onchange="Suma(this.value)"/>
									</label>
								</td>
								<td>
									<b>
										<span>Sexo</span>
									</b>
								</td>
								<td>
									<label>
										<select name="sexo" id="sexo">
											<option selected="selected" value="1">Hombre</option>
											<option value="2">Mujer</option>
										</select>
									</label>
								</td>
								<td>
									<b>
										<span>Edad</span>
									</b>
								</td> 
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #4 (permalink)  
Antiguo 03/11/2011, 15:21
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

Parte dos


Código HTML:
 <td>
									<label>
										<select name="edad" id="edad">
											<option value="1">12-18</option>
											<option selected="selected" value="2">19-25</option>
											<option value="3">26-30</option>
											<option value="4">31-40</option>
											<option value="5">41-50</option>
											<option value="6">51-60</option>
											<option value="7">80 o mas</option>
										</select>
									</label>
								</td>
								<td>
									<b>
										<span>Origen</span>
									</b>
								</td>
								<td style="width: 195px">
									<label>
										<select name="orig" id="orig">
											<option selected="selected" value="1">Imperio de Eros</option>
											<option value="2">Imperio Karano</option>
											<option value="3">Tierras Sumergidas</option>
											<option value="4">Imperio Arun</option>
										</select>
									</label>
									<label>
										<select name="orsec" id="orsec">
											<option selected="selected" value="1">1</option>
											<option value="02">2</option>
											<option value="03">3</option>
											<option value="05">4</option>
											<option value="06">5</option>
											<option value="07">6</option>
											<option value="08">7</option>
											<option value="09">8</option>
											<option value="10">9</option>
											<option value="11">10</option>
											<option value="12">11</option>
											<option value="13">12</option>
											<option value="14">13</option>
											<option value="15">14</option>
											<option value="16">15</option>
											<option value="17">16</option>
											<option value="18">17</option>
											<option value="19">18</option>
											<option value="20">19</option>
											<option value="21">20</option>
								  		</select>
								  	</label>
								</td>
							</tr>
							<tr>
								<td>
									<label>
										<select id="pvig" name="pvig" size="1" onchange="calcula4(this.options.selectedIndex)">
											<option value="5">-50</option>
											<option value="6">-40</option>
											<option value="7">-30</option>
											<option value="8">-20</option>
											<option value="9">-10</option>
											<option value="10" selected="selected">0</option>
											<option value="11">10</option>
											<option value="12">20</option>
											<option value="13">30</option>
											<option value="14">45</option>
											<option value="15">60</option>
											<option value="16">80</option>
											<option value="17">100</option>
											<option value="18">125</option>
											<option value="19">150</option>
											<option value="20">200</option>
										</select>
									</label>
								</td>
								<td>
									<b>
										<span>Vigor</span>
									</b>
								</td>
								<td>
									<label>
										<input type="text" name="vig" id="vig" value="10" maxlength="3" size="4" disabled="disabled" onchange="Suma(this.value)"/>
									</label>
								</td>
								<td colspan="6" rowspan="2">
									<label>
										<b>
											<span>Apariencia<input type="text" name="apa" id="apa" size="200" maxlength="200" style="width: 365px; height: 48px;" value="Como te ves?"/></span>
										</b>
									</label>
								</td>
							</tr>
							<tr>
								<td>
									<label>
										<select id="pesp" name="pesp" size="1" onchange="calcula5(this.options.selectedIndex)">
											<option value="1" selected="selected">0</option>
											<option value="2">50</option>
											<option value="3">100</option>
											<option value="4">150</option>
											<option value="5">200</option>
											<option value="6">250</option>
											<option value="7">300</option>
											<option value="8">350</option>
											<option value="9">400</option>
											<option value="10">450</option>
										</select>				
									</label>
								</td>
								<td>
									<b>
										<span>Espíritu</span>
									</b>
								</td>
								<td>
									<label>
										<input type="text" name="esp" id="esp" value="1" maxlength="3" size="4" disabled="disabled" onchange="Suma(this.value)"/>
									</label>
								</td>
							</tr>
						</tbody>
					</table>
					<table class="t2" align="center">
						<tbody>
							<tr>
								<td>
									<label>usted lleva un total de puntos gastado
										<input name="atr" id="atr" value="0" disabled="disabled" /> <input type="submit" value="Continuar" />
									</label>
								</td>
							</tr>
						</tbody>
					</table>
				</form> 
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #5 (permalink)  
Antiguo 03/11/2011, 15:22
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

scripts usados:


Código:
		<script type="text/javascript">
			function calcula1(){ 
			var operf1 = document.getElementById("pfrs");
			var operando1 = operf1.selectedIndex;
			var ope1 = operf1.options[operando1];
			var pfrs = ope1.value;
			var num = parseInt(document.form1.atr.value);
			var num2 = parseInt(ope1);
			var result = eval(num+pfrs);
			document.form1.atr.value = result;
			document.form1.frs.value = pfrs;}
			function calcula2(){
			var operf2 = document.getElementById("pdes");
			var operando2 = operf2.selectedIndex;
			var ope2 = operf2.options[operando2];
			var pdes = ope2.value;
			document.form1.des.value = pdes;}
			function calcula3(){
			var operf3 = document.getElementById("psab");
			var operando3 = operf3.selectedIndex;
			var ope3 = operf3.options[operando3];
			var psab = ope3.value;
			document.form1.sab.value = psab;}
			function calcula4(){
			var operf4 = document.getElementById("pvig");
			var operando4 = operf4.selectedIndex;
			var ope4 = operf4.options[operando4];
			var pvig = ope4.value;
			document.form1.vig.value = pvig;}
			function calcula5(){
			var operf5 = document.getElementById("pesp");
			var operando5 = operf5.selectedIndex;
			var ope5 = operf5.options[operando5];
			var pesp = ope5.value;
			document.form1.esp.value = pesp;}
			function toggleMe(a){
			var e=document.getElementById(a);
			if(!e)return true;
			if(e.style.display=="none"){
			e.style.display="block"}
			else {
			e.style.display="none"}
			return true;}

		</script>
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #6 (permalink)  
Antiguo 03/11/2011, 15:23
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

scripts usados:


Código:
						<script language="javascript" type="text/javascript">
							var groups=document.form1.raza.options.length
							var group=new Array(groups)
							for (i=0; i<groups; i++)
							group[i]=new Array()
							group[0][0]=new Option("Escoja una Profeción","0000");
							group[1][0]=new Option("Selecione una Profeción","0000");
							group[1][1]=new Option("Guerrero","0001");
							group[1][2]=new Option("Paladin(Caballero)","0002");
							group[1][3]=new Option("Mercenario(Asesino)","0003");
							group[1][4]=new Option("Mago","0004");
							group[1][5]=new Option("Sacerdote","0005");
							group[1][6]=new Option("Brujo","0006");
							group[2][0]=new Option("Selecione una Profeción","0000");
							group[2][1]=new Option("Paladin(Caballero)","0002");
							group[2][2]=new Option("Mago","0004"); 
							group[2][3]=new Option("Sacerdote","0005");
							group[3][0]=new Option("Selecione una Profeción","0000");
							group[3][1]=new Option("Guerrero","0001");
							group[3][2]=new Option("Paladin(Caballero)","0002");
							group[3][3]=new Option("Cazador","0007"); 
							group[4][0]=new Option("Selecione una Profeción"," ");
							group[4][1]=new Option("Guerrero","0001");
							group[4][2]=new Option("Paladin(Caballero)","0002"); 
							group[4][3]=new Option("Mago","0004");
							group[4][4]=new Option("Sacerdote","0005");

							var temp=document.form1.prof
							function redirect(x){
								for (m=temp.options.length-1;m>0;m--)
								temp.options[m]=null
								for (i=0;i<group[x].length;i++){
									temp.options[i]=new Option(group[x][i].text,group[x][i].value);
								}
								temp.options[0].selected=true
							}
						</script>
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #7 (permalink)  
Antiguo 04/11/2011, 11:27
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: update base de datos test pagina

Yo para recuperar la sesión hago:

Código PHP:
if(isset($_SESSION['nombre_de_la_session'])) {
$session $_SESSION['nombre_de_la_sesion'];

__________________
Gracias por el Karma :D

empleo ofertas de trabajo
  #8 (permalink)  
Antiguo 06/11/2011, 01:15
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

gracias lo tomare en cuenta.
si alguien tiene alguna otra sugerencia y puede testar la pagina
la sección recomedadas:

1.Registro
2.Inicio de Sesión.
3.Crear Personaje primera fase.
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #9 (permalink)  
Antiguo 06/11/2011, 11:07
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: update base de datos test pagina

a ver quien me ayuda encontré el problema, pero no se como resolverlo:
tengo un scrip en conjunto con un codigo html

este es el codigo:

Código HTML:
 <select id="pfrs" name="pfrs" size="1" onchange="calcula1(this.options.selectedIndex)">
								<option value="5">-50</option>
								<option value="6">-40</option>
								<option value="7">-30</option>
								<option value="8">-20</option>
								<option value="9">-10</option>
								<option value="10" selected="selected">0</option>
								<option value="11">10</option>
								<option value="12">20</option>
								<option value="13">30</option>
								<option value="14">45</option>
								<option value="15">60</option>
								<option value="16">80</option>
								<option value="17">100</option>
								<option value="18">125</option>
								<option value="19">150</option>
								<option value="20">200</option>
							</select> 
necesito que guarde en una tabla el valor de la selección, ya lo hace y bien, pero necesito que se guarde el valor que le sigue: por ejemplo al escoger -50 el valor guardado es 5, pero necesito pasar por post el -50 en una variable, como se haría??? gracias pro su colaboración:
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB

Etiquetas: test, update
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:32.