Tema: problema
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/03/2012, 16:13
ofertasdiarias
 
Fecha de Ingreso: marzo-2011
Mensajes: 115
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: problema

parte php del codigo
Código PHP:
<?php require_once('Connections/hoysale.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_insert"])) && ($_POST["MM_insert"] == "form1")) {
    
//Guardar imagen
    
if(is_uploaded_file($_FILES['Imagen']['tmp_name'])) { // verifica haya sido cargado el archivo
    
$ruta= "imageness/".$_FILES['Imagen']['name'];
    
$ruta0= "imagen/".$_FILES['Imagen0']['name'];
    
move_uploaded_file($_FILES['Imagen']['tmp_name'], $ruta);
    
move_uploaded_file($_FILES['Imagen0']['tmp_name'], $ruta0);
    
$ruta1= "image/".$_FILES['Imagen1']['name'];
    
$ruta2= "imag/".$_FILES['Imagen2']['name'];
    
move_uploaded_file($_FILES['Imagen1']['tmp_name'], $ruta1);
    
move_uploaded_file($_FILES['Imagen2']['tmp_name'], $ruta2);
    
$ruta3= "ima/".$_FILES['Imagen3']['name'];
    
$ruta4= "im/".$_FILES['Imagen4']['name'];
    
move_uploaded_file($_FILES['Imagen3']['tmp_name'], $ruta3);
    
move_uploaded_file($_FILES['Imagen4']['tmp_name'], $ruta4);
    }

  
$insertSQL = sprintf("INSERT INTO formulario_vehiculos (valor, precios, Moneda, Titulo, Descripcion, Direccion, Codigo_Postal, email, telefono, celular, Imagen, Imagen0, Imagen1, Imagen2, Imagen3, Imagen4, usuario, categoria, Modelo, id_kilometros, ano_vehiculo, id_departamentos, web, tipo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['valor'], "int"),
                       
GetSQLValueString($_POST['precio'], "text"),
                       
GetSQLValueString($_POST['moneda'], "text"),
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['descripcion'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['postal'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"),
                       
GetSQLValueString($_POST['celular'], "text"),
                       
GetSQLValueString($ruta, "text"),
                       
GetSQLValueString($ruta0, "text"),
                       
GetSQLValueString($ruta1, "text"),
                       
GetSQLValueString($ruta2, "text"),
                       
GetSQLValueString($ruta3, "text"),
                       
GetSQLValueString($ruta4, "text"),
                       
GetSQLValueString($_POST['usuario'], "text"),
                       
GetSQLValueString($_POST['categoria'], "int"),
                       
GetSQLValueString($_POST['modelo'], "int"),
                       
GetSQLValueString($_POST['kilometros'], "int"),
                       
GetSQLValueString($_POST['ano'], "int"),
                       
GetSQLValueString($_POST['departamento'], "int"),
                       
GetSQLValueString($_POST['web'], "text"),
                       
GetSQLValueString($_POST['tipo'], "int"));

  
mysql_select_db($database_hoysale, $hoysale);
  
$Result1 = mysql_query($insertSQL, $hoysale) or die(mysql_error());

  
$insertGoTo = "anuncio_creado.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_hoysale, $hoysale);
$query_ver_departamento = "SELECT * FROM departamentos";
$ver_departamento = mysql_query($query_ver_departamento, $hoysale) or die(mysql_error());
$row_ver_departamento = mysql_fetch_assoc($ver_departamento);
$totalRows_ver_departamento = mysql_num_rows($ver_departamento);

mysql_select_db($database_hoysale, $hoysale);
$query_ver_categorias = "SELECT * FROM vehiculos";
$ver_categorias = mysql_query($query_ver_categorias, $hoysale) or die(mysql_error());
$row_ver_categorias = mysql_fetch_assoc($ver_categorias);
$totalRows_ver_categorias = mysql_num_rows($ver_categorias);

mysql_select_db($database_hoysale, $hoysale);
$query_ver_modelos = "SELECT * FROM modelo_vehiculo";
$ver_modelos = mysql_query($query_ver_modelos, $hoysale) or die(mysql_error());
$row_ver_modelos = mysql_fetch_assoc($ver_modelos);
$totalRows_ver_modelos = mysql_num_rows($ver_modelos);

mysql_select_db($database_hoysale, $hoysale);
$query_ver_kilometros = "SELECT * FROM kilometros_vehiculos";
$ver_kilometros = mysql_query($query_ver_kilometros, $hoysale) or die(mysql_error());
$row_ver_kilometros = mysql_fetch_assoc($ver_kilometros);
$totalRows_ver_kilometros = mysql_num_rows($ver_kilometros);

mysql_select_db($database_hoysale, $hoysale);
$query_ver_tipo = "SELECT * FROM buscoofresco";
$ver_tipo = mysql_query($query_ver_tipo, $hoysale) or die(mysql_error());
$row_ver_tipo = mysql_fetch_assoc($ver_tipo);
$totalRows_ver_tipo = mysql_num_rows($ver_tipo);

mysql_select_db($database_hoysale, $hoysale);
$query_ver_ano = "SELECT * FROM ano_vehiculos";
$ver_ano = mysql_query($query_ver_ano, $hoysale) or die(mysql_error());
$row_ver_ano = mysql_fetch_assoc($ver_ano);
$totalRows_ver_ano = mysql_num_rows($ver_ano);

mysql_select_db($database_hoysale, $hoysale);
$query_ver_valor = "SELECT * FROM valor_vehiculos";
$ver_valor = mysql_query($query_ver_valor, $hoysale) or die(mysql_error());
$row_ver_valor = mysql_fetch_assoc($ver_valor);
$totalRows_ver_valor = mysql_num_rows($ver_valor);
?>