Foros del Web » Programando para Internet » PHP »

duda al insertar

Estas en el tema de duda al insertar en el foro de PHP en Foros del Web. Mi duda es la siguiente al momento de querer insertar las variables de producto valores y suma asi dentro de la tabla en mi base ...
  #1 (permalink)  
Antiguo 26/10/2011, 09:20
 
Fecha de Ingreso: junio-2011
Mensajes: 36
Antigüedad: 12 años, 10 meses
Puntos: 0
duda al insertar

Mi duda es la siguiente al momento de querer insertar las variables de producto valores y suma asi dentro de la tabla en mi base de datos al elegir insertar registros no me aparece ninguno de mis formularios asi que no me permite insertar esos datos en mi tabla de mysql me podria decir como le puedo hacer o si no se puede?
<?php require_once('Connections/laboratorio.php');

$producto=$_POST['cotizar'];
$valores=$_POST['valores'];
//$suma=$_POST['suma'];

$cont=count($_POST['cotizar']);

$i=0;
$suma=0;

?>


<?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_laboratorio, $laboratorio);
$query_cotizacion = "SELECT nombre, precio_venta FROM ingreso_productos";
$cotizacion = mysql_query($query_cotizacion, $laboratorio) or die(mysql_error());
$row_cotizacion = mysql_fetch_assoc($cotizacion);
$totalRows_cotizacion = mysql_num_rows($cotizacion);

mysql_select_db($database_laboratorio, $laboratorio);
$query_Recordset1 = "SELECT * FROM cotizacion";
$Recordset1 = mysql_query($query_Recordset1, $laboratorio) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$query_cotizacion = "SELECT nombre, precio_venta FROM ingreso_productos";
$cotizacion = mysql_query($query_cotizacion, $laboratorio) or die(mysql_error());
$row_cotizacion = mysql_fetch_assoc($cotizacion);
$totalRows_cotizacion = mysql_num_rows($cotizacion);
?>
<!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>Untitled Document</title>
<link href="lab.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="header" class="header"></div>
<p>&nbsp;</p>
<div align="right"></div>
<table width="200" border="1">
<tr>
<td>nombre</td>
<td>precio_venta</td>
</tr>
<?php
while($i<$cont)
{

?>
<tr>
<td><form id="form2" name="form2" method="post" action="">
<?php echo $valores[$i]?>
</form></td>

<td><form id="form3" name="form3" method="post" action="">
<?php echo $producto[$i]?>
</form></td>

</tr>

<?php

$i++;
}

?>
<tr><td></td>
<td><form id="form4" name="form4" method="post" action="">
<?php for($i=0;$i<count($_POST['cotizar']);$i++)
{
if(isset($_POST['cotizar'][$i])!=''){
$suma = $suma + $_POST['cotizar'][$i];
}
}
echo $suma; ?>
</form></td></tr>
</table>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="<?php echo $row_cotizacion['']; ?>?variable=<?php echo $suma?>">
<input type="submit" name="button" id="button" value="Enviar por correo electrónico" />
</form>
<p>&nbsp;</p>
<br />
<br />
<div id="foot" class="foot"></div>
</body>
</html>
<?php
mysql_free_result($cotizacion);

mysql_free_result($Recordset1);
?>

Etiquetas: formulario, html, mysql, registro, sql, tabla, variables
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 06:38.