PHP - Trying to access array offset on value of type null in C:\xampp\htdocs\buscador\articulo.php on line

 
Vista:

Trying to access array offset on value of type null in C:\xampp\htdocs\buscador\articulo.php on line

Publicado por user0 (30 intervenciones) el 07/10/2020 02:52:16
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php require_once('connect.php'); ?>
<?php
    $search = '';
    if (isset($_GET['search'])){
        $search = strtolower($_GET['search']);
    }
 
    $id = '';
    if (isset($_GET['id'])){
        $id = $_GET['id'];
    }
 
    $consulta = "SELECT * FROM user WHERE id = '.$id.'";
    $resultado = $connect->query($consulta);
    $fila = mysqli_fetch_assoc($resultado);
    $total = mysqli_num_rows($resultado);
 
    $insert = "UPDATE user SET visitas=visitas+1 WHERE id='.$id.'";
    $update = $connect-> query($insert) || die ("No se ha podido actualizar la página...");
 
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Buscador AJAX Jquery</title>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="ajax.js"></script>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h1>Buscador Ajax</h1>
    <div class="container">
        <div class="center">
        <br><br><br><br><br>
            <img src="PNG.png" width="400">
        <br><br><br><br>
        </div>
        <div class="form center">
        <a href="javascript:history.back(1);">Volver atrás</a>
        </div>
        <div id="resultados">
 
            <h1><?php echo strtoupper(utf8_encode($fila['nombre'])) ?></h1>
            <p><?php echo str_replace($search, '<strong>'.$search.'</strong>', utf8_encode($fila['articulo'])) ?></p>
        </div>
        <div class="footer center">
                Copyright 2014 - Reservados todos los derechos <br>
                <a href="www.google.com">Google</a>
        </div>
    </div>
</body>
</html>

No se porque me duevelve el error del titulo en la linea 15 y 16 que son los echo que imprimen los resultados que son dirigidos de otra pagina que es el buscador
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder