query update non eseguita
-
ho le seguenti tre pagine, dove voglio fare un update dopo una select di dati presenti sul database...la select viene eseguita il form sulla seconda pagina manda i dati alla terza
ma l'update non viene eseguito....sono tre giorni che mi scervello<form id="form1" name="form1" method="post" action="modify_select_incoming.php " onsubmit="validate();return returnVal;"> <p> </p> <table border="1" align="center"> <tr> <td height="37"><div align="center"><strong>Entry Number</strong></div></td> <td><div align="center"><strong>Entry Date</strong></div></td> <td><div align="center"><strong>Customer Reference</strong></div></td> <td><div align="center"><strong>Proforma Delivery</strong></div></td> <td><div align="center"><strong>Data Del</strong></div></td> <td><div align="center"><strong>Carrier</strong></div></td> <td><div align="center"><strong>AWB</strong></div></td> <td><div align="center"><strong>Customer</strong></div></td> <td><div align="center"><strong>Causal</strong></div></td> <td><div align="center"><strong>Select</strong></div></td> </tr> <? $i=1;?> <?php do { ?> <tr> <td height="8"> </td> </tr> <tr> <td><div align="center"><a href="print_item1.php?recordID=<?php echo $row_Recordset1['NUM_BOLLA']; ?>" class="Stile6"> <input type="text" name="<? echo "NUM_BOLLA".$i.""?>" class="text-red-bold" id="NUM BOLLA2" value=" <?php echo $row_Recordset1['NUM_BOLLA']; ?> " size="3" readonly="readonly"/> </a></div></td> <td> <input type="text" name="<? echo "DATA_BOLLA".$i.""?>" id="DATA BOLLA2" value=" <?php echo $row_Recordset1['DATA_BOLLA']; ?>" readonly="readonly" size="10"/></td> <td> <input type="text" name="<? echo "CUSTOMER_REFERENCE".$i.""?>" id="CUSTOMER REFERENCE2" value=" <?php echo $row_Recordset1['CUSTOMER_REFERENCE']; ?>" readonly="readonly" size="10"/></td> <td> <input type="text" name="<? echo "PROFORMA_DELIVERY".$i.""?>" id="PROFORMA DELIVERY2" value="<?php echo $row_Recordset1['PROFORMA_DELIVERY']; ?> " size="10" readonly="readonly"/></td> <td> <input type="text" name="<? echo "DATA_DEL".$i.""?>" id="data del2" value=" <?php echo $row_Recordset1['DATA_DEL']; ?>" readonly="readonly" size="10"/> </td> <td> <input type="text" name="<? echo "CARRIER".$i.""?>" id="carrier2" value=" <?php echo $row_Recordset1['CARRIER']; ?>" readonly="readonly" size="3"/></td> <td> <input type="text" name="<? echo "AWB".$i.""?>" id="awb2" value=" <?php echo $row_Recordset1['TRACK_NUM']; ?>" readonly="readonly"/></td> <td> <input type="text" name="<? echo "CUSTOMER".$i.""?>" id="Customer2" value=" <?php echo $row_Recordset1['SENDER_ID']; ?>" readonly="readonly" size="3"/></td> <td> <input type="text" name="<? echo "CAUSAL".$i.""?>" id="causal2" value=" <?php echo $row_Recordset1['CAUSAL']; ?>" readonly="readonly" size="15"/></td> <td><div align="center"> <input type="radio" name="<? echo "radio".$i.""?>" id="radio" value="on" /> </div></td> </tr> <? $i=$i+1;?> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> <br /> <table border="0"> <tr> <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a> <?php } // Show if not first page ?> </td> <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Rew</a> <?php } // Show if not first page ?> </td> <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Forw</a> <?php } // Show if not last page ?> </td> <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a> <?php } // Show if not last page ?> </td> </tr> </table> <p>Record From <?php echo ($startRow_Recordset1 + 1) ?> To <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?> </p> <p align="center"> <input type="hidden" name="num" id="select" value="<? echo("".$totalRows_Recordset1);?>" /> <input type="submit" name="select" id="select" value="select" /> </p> </form>seconda pagina
<?php require_once('Connections/miaconnessione.php'); ?> <? $num=$_POST['num'];?> <? $i=1; while ($i<$num){ if(isset($_POST["radio".$i.""]) and trim($_POST["radio".$i.""])=='on'){ $NUM_BOLLA=$_POST["NUM_BOLLA".$i.""]; $DATA_BOLLA=$_POST["DATA_BOLLA".$i.""]; $CUSTOMER_REFERENCE=$_POST["CUSTOMER_REFERENCE".$i.""]; $PROFORMA_DELIVERY=$_POST["PROFORMA_DELIVERY".$i.""]; $DATA_DEL=$_POST["DATA_DEL".$i.""]; $CARRIER1=$_POST["CARRIER".$i.""]; $AWB=$_POST["AWB".$i.""]; $CUSTOMER1=$_POST["CUSTOMER".$i.""]; $CAUSAL=$_POST["CAUSAL".$i.""]; } $i=$i+1; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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_miaconnessione, $miaconnessione); $query_CARRIER = "SELECT * FROM carrier"; $CARRIER = mysql_query($query_CARRIER, $miaconnessione) or die(mysql_error()); $row_CARRIER = mysql_fetch_assoc($CARRIER); $totalRows_CARRIER = mysql_num_rows($CARRIER); mysql_select_db($database_miaconnessione, $miaconnessione); $query_CUSTOMER = "SELECT * FROM CUSTOMER"; $CUSTOMER = mysql_query($query_CUSTOMER, $miaconnessione) or die(mysql_error()); $row_CUSTOMER = mysql_fetch_assoc($CUSTOMER); $totalRows_CUSTOMER = mysql_num_rows($CUSTOMER); ?> <? include('head.php')?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <head> <script language="JavaScript" src="Scripts/ts_picker.js" type="text/javascript"></script> <script language="JavaScript" src="Scripts/validation.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript"> function init(){ define('NUM_BOLLA','string','Incoming Number',null,null); define('DATA_BOLLA','string','Incoming Date',null,null); define('CUSTOMER_REFERENCE','string','Customer Refrence',null,null); define('PROFORMA_DELIVERY','string','Delivery Note',null,null); define('data2','string','Proforma/Delivery Date',null,null); define('sel_carrier','string','Carrier',null,null); define('TRACK_NUM','string','Tracking NUmber',null,null); define('CUSTOMER_ID','string','Sender Id',null,null); define('CAUSAL','string','Causal',null,null); }</script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento senza titolo</title> <style type="text/css"> <!-- .Stile6 {font-size: 18px} --> </style> </head> <body onload="init();"> <form action="modify_ok.php" id="form1" name="form1" method="post" onsubmit="validate();return returnVal;"> <table width="100%" border="0"> <tr> <td><div align="center" class="text-big-bold">MODIFY ENTRY</div></td> </tr> </table> <p> </p> <table width="73%" border="1" align="center" class="headerTableLightGray"> <tr> <td width="174" align="right" valign="baseline" nowrap="nowrap"><span class="Stile6">LABEL</span></td> <td width="259" bordercolor="#FF0000"><div align="center" class="Stile6">New Value</div></td> <td width="255" bordercolor="#0000FF"><div align="center" class="Stile6">Current Value</div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Entry Number:</td> <td bordercolor="#FF0000"> <div align="left"> <input type="text" name="NUM_BOLLA" value="<?php echo ("".$NUM_BOLLA);?>" size="32" readonly="readonly" /> </div></td><td bordercolor="#0000FF"><div align="center"><?php echo ("".$NUM_BOLLA); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Entry Date:</td> <td bordercolor="#FF0000"> <div align="left"> <input name="DATA_BOLLA" type="text" value="<?php echo ("".$DATA_BOLLA); ?>" readonly="readonly"/> </div></td><td bordercolor="#0000FF"><div align="center"><?php echo ("".$DATA_BOLLA); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Customer Reference:</td> <td bordercolor="#FF0000"> <div align="left"> <input type="text" name="CUSTOMER_REFERENCE" size="32" /> </div></td><td bordercolor="#0000FF"><div align="center"><?php echo ("".$CUSTOMER_REFERENCE); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Proforma/Delivery:</td> <td bordercolor="#FF0000"> <div align="left"> <input type="text" name="PROFORMA_DELIVERY" size="32" /> </div></td> <td bordercolor="#0000FF"><div align="center"><?php echo ("".$PROFORMA_DELIVERY); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Proforma/Delivery Date:</td> <td bordercolor="#FF0000"> <div align="left"> <input type="text" name="data2" value="" /> <a href="javascript:show_calendar('document.form1.data2', document.form1.data2.value);"> <img src="Scripts/cal.gif" width="16" height="16" border="0" alt="Select Date" /></a></div></td> <td bordercolor="#0000FF"><div align="center"><?php echo ("".$DATA_DEL); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Carrier:</td> <td bordercolor="#FF0000"> <div align="left"> <select name="sel_carrier" id="select" title="<?php echo $row_Recordset1['CARRIER']; ?>"> <option value="NULL"></option> <?php do { ?> <option value="<?php echo $row_CARRIER['ID_CARRIER']?>"><?php echo $row_CARRIER['ID_CARRIER']?></option> <?php } while ($row_CARRIER = mysql_fetch_assoc($CARRIER)); $rows = mysql_num_rows($CARRIER); if($rows > 0) { mysql_data_seek($CARRIER, 0); $row_CARRIER = mysql_fetch_assoc($CARRIER); } ?> </select> </div></td> <td bordercolor="#0000FF"><div align="center"><?php echo ("".$CARRIER1); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Tracking Number(AWB):</td> <td bordercolor="#FF0000"><div align="left"><a href="New_CUSTOMER.php"> <input type="text" name="TRACK_NUM" size="32" /> </a></div></td> <td bordercolor="#0000FF"><div align="center"><?php echo ("".$AWB); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Sender Id</td> <td bordercolor="#FF0000"> <div align="left"> <select name="CUSTOMER_ID" title="<?php echo $row_Recordset1['SENDER_ID']; ?>"> <option value="NULL"></option> <?php do { ?> <option value="<?php echo $row_CUSTOMER['ID']?>"><?php echo $row_CUSTOMER['ID']?></option> <?php } while ($row_CUSTOMER = mysql_fetch_assoc($CUSTOMER)); $rows = mysql_num_rows($CUSTOMER); if($rows > 0) { mysql_data_seek($CUSTOMER, 0); $row_CUSTOMER = mysql_fetch_assoc($CUSTOMER); } ?> </select> </div></td> <td bordercolor="#0000FF"><div align="center"><?php echo ("".$CUSTOMER1); ?></div></td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap">Causal:</td> <td bordercolor="#FF0000"> <div align="left"> <input type="text" name="CAUSAL" value="" size="32" /> </div></td> <td bordercolor="#0000FF"><div align="center"><?php echo ("".$CAUSAL); ?></div></td> </tr> </table> <p align="center"> </p> <div align="center"> <input type="hidden" name="MM_update" value="form1" /> <input type="submit" name="button" id="button" value="modify" /> </div> </form> </body> </html> <?php mysql_free_result($CARRIER); mysql_free_result($CUSTOMER); ?> <? include('footer.php');?>terza pagina:
<?php require_once('Connections/miaconnessione.php'); ?> <?php include ('redirect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } ?> <? if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE shipping_document_in SET CUSTOMER_REFERENCE=%s, PROFORMA_DELIVERY=%s, DATA_DEL=%s, CARRIER=%s, TRACK_NUM=%s, SENDER_ID=%s, CAUSAL=%s WHERE NUM_BOLLA=%s", GetSQLValueString($_POST['CUSTOMER_REFERENCE'], "text"), GetSQLValueString($_POST['PROFORMA_DELIVERY'], "text"), GetSQLValueString($_POST['data2'], "date"), GetSQLValueString($_POST['sel_carrier'], "text"), GetSQLValueString($_POST['TRACK_NUM'], "text"), GetSQLValueString($_POST['CUSTOMER_ID'], "text"), GetSQLValueString($_POST['CAUSAL'], "text"), GetSQLValueString($_POST['NUM_BOLLA'], "text"), GetSQLValueString($_POST['DATA_BOLLA'], "date")); mysql_select_db($database_miaconnessione, $miaconnessione); $Result1 = mysql_query($updateSQL, $miaconnessione) or die(mysql_error()); } ?> <? include('head.php');?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento senza titolo</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" border="0"> <tr> <td><p align="center">aggiornamento effettuato con successo </p> <p align="center">tra cinque secondi si verre reindirizzati sulla pagina di accesso</p> <? redirect("", 5);?> <p> </p></td> </tr> </table> </body> </html> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <? include ("footer.php");?>il problema sorge sulla terza pagina la query non viene eseguita ma non ci sono errori di sintassi ma non viene effettuare alcuna modifica
non capisco....dove sbaglio -
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi