• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

257
Vistas
How to remove/hide text at the very top of the page

Problem

I would like to know how I would make the text at the top of the screen not show when connecting or searching the database. Below is a screenshot of what I am talking about.

Screenshot of webpage

Is it possible for it to not appear at all? Below is the code that connects to the database, as well as the code for the form below.

Code

The code to connect to the database:

<?php       
    // Connecting, selecting database
    $dbconn = pg_connect("host=***** port=*****
    dbname=***** user=***** password=*****")
    or die('Could not connect: ' . pg_last_error());

    //collect
    if(isset($_POST['search'])) {
        $searchq = $_POST['search'];
        // $searchq = preg_replace("#[^0-9a-z]#i"."".$searchq);

    // Performing SQL query
    $query = "SELECT vegan FROM enumbers WHERE code LIKE '%$searchq%'";
    $ret = pg_query($dbconn, $query);
   if(!$ret){
      echo pg_last_error($dbconn);
      exit;
   } 
   $output = '';
   while($row = pg_fetch_assoc($ret)){
            $code = $row['code'];
            print_r($row);
            $name = $row['name'];
            $type = $row['type'];
            $vegan = $row['vegan'];

            $output .= '<div> '.vegan.' ';
   }
}
   echo "Operation done successfully\n";
   pg_close($dbconn);

?>

The code for the form:

<div id="tablebox">
            <!-- Search bar -->
            <p>Is It Vegan?</p>
            <form name="form1" method="post" action="searchEnumbers.php">
                <input name="search" type="text" size="30" maxlength="5" />
                <input name="submit" type="submit" value="Search" />
            </form>

            <?php
                print("$output");
            ?>
        </div>


  </div>
over 3 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Just remove these two lines from your code

print_r($row);

.....

echo "Operation done successfully\n";
over 3 years ago · Santiago Trujillo Denunciar

0

Try this one, Changes are noted via php comment (//)

<?php       
    // Connecting, selecting database
    $dbconn = pg_connect("host=***** port=*****
    dbname=***** user=***** password=*****")
    or die('Could not connect: ' . pg_last_error());

    //collect
    if(isset($_POST['search'])) {
        $searchq = $_POST['search'];
        // $searchq = preg_replace("#[^0-9a-z]#i"."".$searchq);

    // Performing SQL query
    $query = "SELECT vegan FROM enumbers WHERE code LIKE '%$searchq%'";
    $ret = pg_query($dbconn, $query);
   if(!$ret){
      echo pg_last_error($dbconn);
      exit;
   } 
   $output = '';
   while($row = pg_fetch_assoc($ret)){
            $code = $row['code'];
            //Commented 1
            //print_r($row);
            $name = $row['name'];
            $type = $row['type'];
            $vegan = $row['vegan'];

            $output .= '<div> '.vegan.' ';
   }
}
   //Commented 2
   //echo "Operation done successfully\n";
   pg_close($dbconn);

?>
over 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda