Este es el PHP
Código PHP:
<?
include ("includes/table.php");
$host = "localhost"; // el host de la base de datos
$user = "phpmysql_phpmysq"; // usuario de la base de datos, antes solo era phpmysql"
$pass = "drakon"; // contraseña de la base de datos
$bbdd = "phpmysql_mysql"; // base de datos a usar
/*********** esto crea la conexión a la base de datos **************/
$conexio = mysql_connect($host,$user,$pass) or die("resultado=".urlencode(mysql_error())); // $conexion es la conexión a usar.
mysql_select_db($bbdd,$conexio) or die("resultado=".urlencode(mysql_error()));
/*
Nuestro campo en la base de datos lo hemos creado con la siguiente consulta:
CREATE TABLE `flash2sql` (
`ID` INT NOT NULL AUTO_INCREMENT ,
`CAMPO1` VARCHAR( 255 ) NOT NULL ,
`CAMPO2` VARCHAR( 255 ) NOT NULL ,
`CAMPO3` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `ID` ) );
*/
// consulta: INSERT INTO `flash2sql` ( `ID` , `CAMPO1` , `CAMPO2` , `CAMPO3` ) VALUES ('', 'a', 'b', 'c');
if($REQUEST_METHOD == "POST"){
$idm = htmlentities($_POST[idm]);
$producto = htmlentities($_POST[producto]);
$codigo = htmlentities($_POST[codigo]);
$precio = htmlentities($_POST[precio]);
$deposito1 = htmlentities($_POST[deposito1]);
$deposito2 = htmlentities($_POST[deposito2]);
$suc1 = htmlentities($_POST[suc1]);
$suc2 = htmlentities($_POST[suc2]);
$suc3 = htmlentities($_POST[suc3]);
$suc4 = htmlentities($_POST[suc4]);
$suc5 = htmlentities($_POST[suc5]);
$suc6 = htmlentities($_POST[suc6]);
$ven1 = htmlentities($_POST[ven1]);
$ven2 = htmlentities($_POST[ven2]);
$ven3 = htmlentities($_POST[ven3]);
$ven4 = htmlentities($_POST[ven4]);
$ven5 = htmlentities($_POST[ven5]);
$ven6 = htmlentities($_POST[ven6]);
$vent = htmlentities($_POST[vent]);
$mon1 = htmlentities($_POST[mon1]);
$mon2 = htmlentities($_POST[mon2]);
$mon3 = htmlentities($_POST[mon3]);
$mon4 = htmlentities($_POST[mon4]);
$mon5 = htmlentities($_POST[mon5]);
$mon6 = htmlentities($_POST[mon6]);
$mont = htmlentities($_POST[mont]);
$obs1 = htmlentities($_POST[obs1]);
$obs2 = htmlentities($_POST[obs2]);
$csql = "INSERT INTO $TABLE ( `id` , `producto` , `codigo` , `precio`, `deposito1`, deposito2`, `suc1`, `suc2`, `suc3`, `suc4`, `suc5`, `suc6`, `obs1`, `obs2` ) VALUES ('$idm', '$producto', '$codigo' , '$precio', '$deposito1','$deposito2', '$suc1', '$suc2', '$suc3', '$suc4', '$suc5', '$suc6','$obs1', '$obs2') ;";
mysql_query($csql)or die("resultado=".urlencode(mysql_error()));
echo "resultado=Insertado Correctamente!";
}
?>