Señores alguien sabe porq no funciona el insert que deseo hacer ?? creo que como no he descansado desde muy temprano el coco no me funca
Código PHP:
Ver original<?php
include('c.php');
//$mysqli = new mysqli("localhost","root","","kosys"); no funciona a si
if($mysqli->connect_errno){echo "Fallo la conexion a la Base de datos !!! (Error: " .$mysqli->connect_errno. ")" ;}
else{
$n = '';
$d = '';
$r = '';
$p = '';
$c = '';
$m = '';
$dt = '';
if ($_POST){
$n = $_POST['nombre'];
$d = $_POST['desc'];
$r = $_POST['rubro'];
$p = $_POST['provee'];
$c = $_POST['costo'];
$m = $_POST['mayoreo'];
$dt = $_POST['detalle'];
$ins = $mysqli->query("insert into productos (id,nombre,descripcion,rubro,proveedor,costo,
pre_may,pre_det,activo,userid,fecha) values('','$n','$d','$r','$p','$c','$m','$dt','1','1')");
if ($ins){
Echo "Registro Agregado con exito !!";
}
else{
echo "Error al Agregar<br>";
}
}
}
?>
<html>
<head>
<title>Mantenimiento</title>
</head>
<body>
<table width='900px' height='225px' align='left'>
<tr>
<td>
<fieldset>
<legend>
<font color='#000000' style='font-family: Comic Sans MS;'>
..:: Agregar Nuevo Producto ::..
</font>
</legend>
<br/>
<form method='post' action='' name='admin' id='admin' >
<table width='100%'>
<tr>
<td>
<b>Nombre:
</b><input type='text' name='nombre' size='50' maxlenght='100' class='caja' style='padding: 0.3em;'/> <br>
</td>
<td>
<b>Descripcion:
</b><input type='text' name='desc' size='50' maxlenght='200' class='caja' style='padding: 0.3em;'/> <br>
</td>
</tr>
<tr>
<td>
<b> Rubro:
<input type='text' name='rubro' size='5' maxlenght='1' class='caja' style='padding: 0.3em;'/>
<b> Proveedor:
<input type='text' name='provee' size='5' maxlenght='1' class='caja' style='padding: 0.3em;'/>
</td>
<td>
<br/> <b>Costo:</b>
<input type='text' name='costo' id='costo' size='5' onchange='precios()' maxlenght='10' class='caja' style='padding: 0.3em;'/>
<b>Mayoreo:</b>
<input type='text' name='mayoreo' id='mayoreo' size='5' maxlenght='10' class='caja' style='padding: 0.3em;'/>
<b>Detalle:</b>
<input type='text' name='detalle' id='detalle' size='5' maxlenght='10' class='caja' style='padding: 0.3em;'/><br><br>
</td>
</tr>
<tr>
<td align='center'><br/>
<input type='submit' value='Agregar' name='registrar' style='padding:0.3em;'/>
<input type='reset' value='Limpiar' name='limpiar' style='padding:0.3em;'/>
<a href="index.php"><input type='button' value='Cancelar' name='cancelar' style='padding:0.3em;'/></a><br><br>
</td>
</tr>
</table>
</form>
</fieldset>
</td>
</tr>
</table>
</body>
</html>
Algo por ahi no a de estar en su sitio, y si tengo mal ejecutado algo me pueden decir no hay problema !!!
Basicamente es un formulario con "post" y cuando se envian los datos debe generar el codigo php que esta al inicio, ya probe solo imprimiendo los datos del _POST y si salen todos
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
!!!!