Ayuda sobre sistema de noticias en php

  • Autor Autor JamesPierre
  • Fecha de inicio Fecha de inicio
J

JamesPierre

Dseda
Verificado
Verificación en dos pasos activada
Verificado por Whatsapp
Hola amigos, les pido de porfa que me hechen una mano, tengo un script de php de sistema de noticias, pero a este quiero quitarle el upload de imagenes, les pego el codigo para que lo chekeen y me digan que linea se tiene que retirar...

Les estaré muy agradecido...

PHP:
<?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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
		if(is_uploaded_file($_FILES['foto']['tmp_name'])) { // verifica haya sido cargado el archivo
$ruta= 'images/'.rand(000,999).$_FILES['foto']['name'];
move_uploaded_file($_FILES['foto']['tmp_name'], $ruta);
}
  $insertSQL = sprintf("INSERT INTO noticias (titulo, subtitulo, descripcion, foto, fecha) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['titulo'], "text"),
                       GetSQLValueString($_POST['subtitulo'], "text"),
                       GetSQLValueString($_POST['descripcion'], "text"),
                       GetSQLValueString($ruta, "text"),
                       GetSQLValueString($_POST['fecha'], "text"));

  mysql_select_db($database_cn, $cn);
  $Result1 = mysql_query($insertSQL, $cn) or die(mysql_error());

  $insertGoTo = "noticias.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
 
... solo deja que te respondan no flodeando con PM mi casilla... -.-
saca esto
PHP:
        if(is_uploaded_file($_FILES['foto']['tmp_name'])) { // verifica haya sido cargado el archivo
$ruta= 'images/'.rand(000,999).$_FILES['foto']['name'];
move_uploaded_file($_FILES['foto']['tmp_name'], $ruta);
}
 
jajaja lo siento hermano, necesitaba ayuda, lo siento...

... solo deja que te respondan no flodeando con PM mi casilla... -.-
saca esto
PHP:
        if(is_uploaded_file($_FILES['foto']['tmp_name'])) { // verifica haya sido cargado el archivo
$ruta= 'images/'.rand(000,999).$_FILES['foto']['name'];
move_uploaded_file($_FILES['foto']['tmp_name'], $ruta);
}
ya lo intente y queda en blanco
clic aqui
 
jajaja lo siento hermano, necesitaba ayuda, lo siento...


ya lo intente y queda en blanco
clic aqui

eso pasa porque no tenes para que muestre los errores asi no sabras que problema tenes.! cuando soluciones eso y veas cual es el error sabras como solucionarlo
 
despues de intentos, ya pude corregirlo, pero ahora cuando inserto una noticia me arroja este error
HTML:
Column 'foto' cannot be null

Alguien tiene conocimiento a que refiere eso? si ya retire el uploader de fotos, joderr no entiendo me volvere locooooo 🙁


Help mee
 
despues de intentos, ya pude corregirlo, pero ahora cuando inserto una noticia me arroja este error
HTML:
Column 'foto' cannot be null

Alguien tiene conocimiento a que refiere eso? si ya retire el uploader de fotos, joderr no entiendo me volvere locooooo 🙁


Help mee

No vi tu codigo pero supongo que si eliminastes algo del codigo tienes que verificar donde se valida esa info, ese error se refiere a que la columna "foto" no puede estar vacia
 
Atrás
Arriba