Foros del Web » Programando para Internet » PHP »

como insertar varias consultas en php y saber que campos se marcaron ?

Estas en el tema de como insertar varias consultas en php y saber que campos se marcaron ? en el foro de PHP en Foros del Web. Alguien que me ayude con el siguiente problema. Quien Sabe Como relizar un numero N de insercion en una vase de datos dependiendo de la ...
  #1 (permalink)  
Antiguo 19/03/2012, 13:54
 
Fecha de Ingreso: noviembre-2011
Ubicación: Yopal
Mensajes: 12
Antigüedad: 12 años, 5 meses
Puntos: 0
como insertar varias consultas en php y saber que campos se marcaron ?

Alguien que me ayude con el siguiente problema.

Quien Sabe Como relizar un numero N de insercion en una vase de datos dependiendo de la cantidad de casillas que se hallan marcado.

El Codigo que manejo es el siguiente:

Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

mysql_select_db($database_pxndx920720$pxndx920720);
$query_grados "SELECT * FROM algrado ORDER BY grado ASC";
$grados mysql_query($query_grados$pxndx920720) or die(mysql_error());
$row_grados mysql_fetch_assoc($grados);
$totalRows_grados mysql_num_rows($grados);

mysql_select_db($database_pxndx920720$pxndx920720);
$query_profes "SELECT * FROM alusuarios WHERE nivel = 3 ORDER BY apellidoa ASC";
$profes mysql_query($query_profes$pxndx920720) or die(mysql_error());
$row_profes mysql_fetch_assoc($profes);
$totalRows_profes mysql_num_rows($profes);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php 
$filtro
=$_POST['bandera'];
 if (
$filtro==458)
{
#aqui quiero que se realize la insercion en la tabla alareas pero quiero una insercion por cada grado que se marco     
}
    
    
?>
<form id="form1" name="form1" method="post" action="">
  <table width="511" border="1" align="center">
    <tr>
      <th colspan="2" scope="col">REGISTAR NUEVA AREA ACADEMICA</th>
    </tr>
    <tr>
      <td width="208">Nombre De La Asiganatura</td>
      <td width="287"><span id="sprytextfield1">
        <label for="text1"></label>
        <input name="text1" type="text" id="text1" size="40" />
      <span class="textfieldRequiredMsg">Se necesita un valor.</span></span></td>
    </tr>
    <tr>
      <td>Docente</td>
      <td><label for="prof"></label>
        <select name="prof" id="prof">
          <?php
do {  
?>
          <option value="<?php echo $row_profes['id']?>"><?php echo $row_profes['nombre']; echo " "; echo $row_profes['apellidoa']; echo " "; echo $row_profes['apellidob']; ?></option>
          <?php
} while ($row_profes mysql_fetch_assoc($profes));
  
$rows mysql_num_rows($profes);
  if(
$rows 0) {
      
mysql_data_seek($profes0);
      
$row_profes mysql_fetch_assoc($profes);
  }
?>
      </select></td>
    </tr>
    <tr>
      <td>Intensidad Horaria</td>
      <td><span id="sprytextfield2">
      <label for="text2"></label>
      <input type="text" name="text2" id="text2" />
      <span class="textfieldInvalidFormatMsg">Formato no válido.</span><span class="textfieldMinValueMsg">El valor introducido es inferior al mínimo permitido.</span><span class="textfieldMaxValueMsg">El valor introducido es superior al máximo permitido.</span><span class="textfieldRequiredMsg">Se necesita un valor.</span></span></td>
    </tr>
    <tr>
      <td>Logro Para Primer Periodo</td>
      <td><span id="sprytextarea1">
      <label for="textarea1"></label>
      <textarea name="textarea1" id="textarea1" cols="45" rows="5"></textarea>
      <span id="countsprytextarea1">&nbsp;</span><span class="textareaRequiredMsg">Se necesita un valor.</span><span class="textareaMaxCharsMsg">Se ha superado el número máximo de caracteres.</span></span></td>
    </tr>
    <tr>
      <td>Logro Para Segundo Periodo</td>
      <td><span id="sprytextarea2">
      <label for="textarea2"></label>
      <textarea name="textarea2" id="textarea2" cols="45" rows="5"></textarea>
      <span id="countsprytextarea2">&nbsp;</span><span class="textareaRequiredMsg">Se necesita un valor.</span><span class="textareaMaxCharsMsg">Se ha superado el número máximo de caracteres.</span></span></td>
    </tr>
    <tr>
      <td>Logro Para Tercer Periodo</td>
      <td><span id="sprytextarea3">
      <label for="textarea3"></label>
      <textarea name="textarea3" id="textarea3" cols="45" rows="5"></textarea>
      <span id="countsprytextarea3">&nbsp;</span><span class="textareaRequiredMsg">Se necesita un valor.</span><span class="textareaMaxCharsMsg">Se ha superado el número máximo de caracteres.</span></span></td>
    </tr>
    <tr>
      <td>Logro Para Cuarto Periodo</td>
      <td><span id="sprytextarea4">
      <label for="textarea4"></label>
      <textarea name="textarea4" id="textarea4" cols="45" rows="5"></textarea>
      <span id="countsprytextarea4">&nbsp;</span><span class="textareaRequiredMsg">Se necesita un valor.</span><span class="textareaMaxCharsMsg">Se ha superado el número máximo de caracteres.</span></span></td>
    </tr>
    <tr>
      <td>Aplica A Los Grados:</td>
      <td><?php do { ?>
      <?php echo $row_grados['grado']; echo " - "; echo $row_grados['dependencia']; echo " - "; echo $row_grados['jornada']; ?><input type="checkbox" value="<?php echo $row_grados['idgrado']; ?>" name="grado" id="grado" />
      <br />
<?php } while ($row_grados mysql_fetch_assoc($grados)); ?></td>
    </tr>
    <tr>
      <td><input name="bandera" type="hidden" id="bandera" value="458" />
      </td>
      <td><div align="center">
        <input type="submit" name="button" id="button" value="Registar Grado" />
      </div></td>
    </tr>
  </table>
</form>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {minValue:0, maxValue:50});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {maxChars:450, counterType:"chars_remaining", counterId:"countsprytextarea1"});
var sprytextarea2 = new Spry.Widget.ValidationTextarea("sprytextarea2", {maxChars:450, counterType:"chars_remaining", counterId:"countsprytextarea2"});
var sprytextarea3 = new Spry.Widget.ValidationTextarea("sprytextarea3", {maxChars:450, counterType:"chars_remaining", counterId:"countsprytextarea3"});
var sprytextarea4 = new Spry.Widget.ValidationTextarea("sprytextarea4", {maxChars:450, counterType:"chars_remaining", counterId:"countsprytextarea4"});
</script>
</body>
</html>
<?php
mysql_free_result
($grados);

mysql_free_result($profes);
?>

la estructura de la tabla alareas es esta:

idarea - nombre - logroa - logrob - logroc - logrod - inthora - iddocente - idgrado



no se como realizar una inserción por cada grado que se halla marcado
ayuda!!

Última edición por alexandrox92; 19/03/2012 a las 14:32 Razón: olvide algo

Etiquetas: mysql+php
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 20:39.