El problema está en que solo me inserta en la tabla tags en la tabla persoas no hace modificacion alguna, el codigo es este
Código PHP:
<?php require_once('Connections/bd_contactos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO persoas (cod_prsa, cod_nme, cod_aplds, txt_nome_aclme, txt_aplds_aclme, txt_tlfno_trbllo, txt_tlfno_dmclo, txt_tlfno_mbl, txt_fx, cod_crro_1, cod_crro_2, cod_url, cod_ra, cod_nmr_ra, cod_nmr_pso, cod_endrzo_info_pls, cod_cp, cod_pblcn, cod_prvnca, cod_pis) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['cod_prsa'], "int"),
GetSQLValueString($_POST['cod_nme'], "text"),
GetSQLValueString($_POST['cod_aplds'], "text"),
GetSQLValueString($_POST['txt_nome_aclme'], "text"),
GetSQLValueString($_POST['txt_aplds_aclme'], "text"),
GetSQLValueString($_POST['txt_tlfno_trbllo'], "text"),
GetSQLValueString($_POST['txt_tlfno_dmclo'], "text"),
GetSQLValueString($_POST['txt_tlfno_mbl'], "text"),
GetSQLValueString($_POST['txt_fx'], "text"),
GetSQLValueString($_POST['cod_crro_1'], "text"),
GetSQLValueString($_POST['cod_crro_2'], "text"),
GetSQLValueString($_POST['cod_url'], "text"),
GetSQLValueString($_POST['cod_ra'], "text"),
GetSQLValueString($_POST['cod_nmr_ra'], "text"),
GetSQLValueString($_POST['cod_nmr_pso'], "text"),
GetSQLValueString($_POST['cod_endrzo_info_pls'], "text"),
GetSQLValueString($_POST['cod_cp'], "text"),
GetSQLValueString($_POST['cod_pblcn'], "text"),
GetSQLValueString($_POST['cod_prvnca'], "text"),
GetSQLValueString($_POST['cod_pis'], "text"));
$insertSQL = sprintf("INSERT INTO tags (cod_tag, txt_tag, tpo_tag) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['cod_tag'], "int"),
GetSQLValueString($_POST['txt_tag'], "text"),
GetSQLValueString($_POST['tpo_tag'], "text"));
mysql_select_db($database_bd_contactos, $bd_contactos);
$Result1 = mysql_query($insertSQL, $bd_contactos) or die(mysql_error());
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<style type="text/css">
<!--
.Estilo1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Nome:</span></td>
<td><input type="text" name="cod_nme" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Apelidos:</span></td>
<td><input type="text" name="cod_aplds" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Alcume nome:</span></td>
<td><input type="text" name="txt_nome_aclme" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Alcume apelidos:</span></td>
<td><input type="text" name="txt_aplds_aclme" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Tlf traballo:</span></td>
<td><input type="text" name="txt_tlfno_trbllo" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Tlf domicilio:</span></td>
<td><input type="text" name="txt_tlfno_dmclo" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Tlf móbil:</span></td>
<td><input type="text" name="txt_tlfno_mbl" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Fax:</span></td>
<td><input type="text" name="txt_fx" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">email nº1:</span></td>
<td><input type="text" name="cod_crro_1" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Email nº2:</span></td>
<td><input type="text" name="cod_crro_2" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Páxina web:</span></td>
<td><input type="text" name="cod_url" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Domicilio:</span></td>
<td><input type="text" name="cod_ra" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Nº domicilio:</span></td>
<td><input type="text" name="cod_nmr_ra" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Nº Piso:</span></td>
<td><input type="text" name="cod_nmr_pso" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Cod_endrzo_info_pls:</span></td>
<td><input type="text" name="cod_endrzo_info_pls" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">CP:</span></td>
<td><input type="text" name="cod_cp" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Poboación:</span></td>
<td><input type="text" name="cod_pblcn" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">Provincia:</span></td>
<td><input type="text" name="cod_prvnca" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap"><span class="Estilo1">País:</span></td>
<td><input type="text" name="cod_pis" value="" size="32"></td>
</tr>
<td nowrap align="right"><span class="Estilo1">Tag:</span></td>
<td><input type="text" name="txt_tag" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"><span class="Estilo1">Tipo Tag:</span></td>
<td><input type="text" name="tpo_tag" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><div align="center">
<input type="submit" value="Insertar registro">
</div></td>
</tr>
</table>
<input type="hidden" name="cod_prsa" value="">
<input type="hidden" name="cod_tag" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</body>
</html>