Ver Mensaje Individual
  #58 (permalink)  
Antiguo 02/05/2016, 15:18
Avatar de jearj
jearj
 
Fecha de Ingreso: julio-2008
Mensajes: 72
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: insertar url en campo de db al iniciar sesion los usuarios

He solucionado algunos errores hasta que he llegado aquí:
$noticias = mysqli_query($conexion, $query_limit_noticias) or die(mysqli_error());

Me sale este error:
Warning: mysqli_error() expects exactly 1 parameter, 0 given

he leído algunas cosas sobre ese error y pone que lo haga así:
$noticias = mysqli_query($conexion, $query_limit_noticias) or die(mysqli_error($conexion));

Me sale este error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 4' at line 1

Y ahí ya me pierdo.

¿Alguien sabe como solucionarlo?


Esta es la parte del código:

$startRow_noticias = $pageNum_noticias * $maxRows_noticias;

mysqli_select_db($conexion, $database_conexion);
$query_noticias = "SELECT * FROM anuncios ORDER BY id_noticia DESC";
$query_limit_noticias = sprintf("%s LIMIT %d, %d", $queryi_noticias, $startRow_noticias, $maxRows_noticias);
$noticias = mysqli_query($conexion, $query_limit_noticias) or die(mysqli_error($conexion));
$row_noticias = mysqli_fetch_assoc($noticias);

if (isset($_GET['totalRows_noticias'])) {
$totalRows_noticias = $_GET['totalRows_noticias'];
} else {
$all_noticias = mysqli_query($query_noticias);
$totalRows_noticias = mysqli_num_rows($all_noticias);
}