![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
03/03/2011, 12:12
|
| | Fecha de Ingreso: febrero-2007 Ubicación: Caracas
Mensajes: 148
Antigüedad: 18 años Puntos: 6 | |
Respuesta: No Puedo Agregar algo a la BD
Código:
Este es mi codigo de Megusta
echo "<td width='280' align='left'><div class='catalogo_descripcion'><h1>" . ucwords(strtolower($row[Descripcion])) . "</h1><h2>COD " . $row[CodigoProducto] . "</h2><h3>" . money_format('%.2n', $row[PrecioUnitario1]) . "</h3><div><form action='' method='post' name='formmegusta' id='formmegusta'><input name='mgusta' type='button' id='mgusta' value='Me Gusta' onClick='megusta()'/><input name='quehacer' type='hidden' id='quehacer'></form></div><a href='?pag=detalle&id=" . $row[CodigoProducto] . "'>Ver Detalle</a></div><a href='?pag=detalle&id=" . $row[CodigoProducto] . "'><img src='" . $imagen . "' border='0' alt='" . $row[Descripcion] . "' /></a></td>\n";
Y este es la accion
<?
include ($_SERVER[DOCUMENT_ROOT] . "/proyectocrossh/sec/funciones.php");
if($_POST[quehacer]=="megusta")
{
$consulta = "select * from categorias where desc_categoria = '".$_POST[mgusta]."' ";
$resultado = mysql_query($consulta);
$num_filas = mysql_num_rows($resultado);
if(!$num_filas)
{
$consulta = "insert into categorias values ('".$_POST[mgusta]."' )";
$resultado = mysql_query($consulta);
}
else
{
?>
<script language="javascript" type="text/javascript">
alert("La Descripción ya exite\n intente con otra.")
history.go(-1)
</script>
<?
}
}
?>
<script language="javascript" type="text/javascript">
alert ("Gracias.");
location.href='plantilla_catalogo.php';
</script>
|