
GET - Ampliar
Publicado por Tomás (81 intervenciones) el 04/09/2013 10:42:23
Mira al darle a leer noticia me tira este error cuándo entro a aplicarnoticia.php
url (asin em sale cuando le doy a leer noticia):
---------------------------------------------------------------------------------------------------------------------------------------
Este es el código de aplicarnoticia.php:
---------------------------------------------------------------------------------------------------------------------------------------
Y este el código del index dónde se muestra las noticias y donde sale para ir a leer al completo:
-------------------------------------------------------------------------------------------------------------------------------------
Saludos.
url (asin em sale cuando le doy a leer noticia):
1
http://localhost/noticias/ampliarnoticia.php?id=
1
2
3
4
5
Warning: mysqli_query() expects parameter 2 to be string, object given in C:\xampp\htdocs\noticias\ampliarnoticia.php on line 11
Warning: mysqli_fetch_row() expects exactly 1 parameter, 2 given in C:\xampp\htdocs\noticias\ampliarnoticia.php on line 13
Warning: mysqli_free_result() expects exactly 1 parameter, 2 given in C:\xampp\htdocs\noticias\ampliarnoticia.php on line 19
---------------------------------------------------------------------------------------------------------------------------------------
Este es el código de aplicarnoticia.php:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include ("config.php");
$registro = $_GET['id'];
$consulta = mysqli_query($conexion, "SELECT * FROM noticias WHERE id = ('".$registro."')"); //Ojo a las comillas.
$resultado = mysqli_query($conexion, $consulta);
$noticia= mysqli_fetch_row($conexion, $resultado);
$cabecera = $noticia['1'];
$todo_texto = $noticia['4'];
//liberamos y cerramos la conexión
mysqli_free_result($conexion, $resultado);
mysqli_close($conexion);
//Mostramos la noticia
echo "<strong>" . $cabecera . "</strong><br>" . $todo_texto;
?>
---------------------------------------------------------------------------------------------------------------------------------------
Y este el código del index dónde se muestra las noticias y donde sale para ir a leer al completo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html lang="es" />
<head>
<title> Noti </title>
</head>
<body>
<?php
include ("config.php");
$news = mysqli_query($conexion, "SELECT cabecera,fecha,pre_texto FROM noticias")or die("Error en la seleccion de datos");
while($new = mysqli_fetch_array($news))
{
echo "<b>".$new['cabecera']."</b> ".$new['fecha']."<br><br>";
echo "<i>".$new['pre_texto']."</i><br><br>";
echo "<br>";
echo "<a href='ampliarnoticia.php?id=$new[id]' >Leer la noticia al completo</a>";
echo "<hr>";
}
?>
</body>
</html>
-------------------------------------------------------------------------------------------------------------------------------------
Saludos.
Valora esta pregunta


0