Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Mysql database

  1. #1

    Mysql database

    Sto provando a costruire una searchbar con php e database mysql, solamente che non funziona e non so proprio perchè: vi lascio l'immagine della struttura della tabella, l'indirizzo e il codice.
    Link= https://hard-questions.com/try/ggg.php
    Link immagini: 1)https://i.snipboard.io/37J0Uu.jpg
    2)https://i.snipboard.io/yeho3x.jpg



    codice:
    <html>
    <head>
        <title>Search Bar using PHP</title>
    </head>
    <body>
    <form method="post">
    <label>Search</label>
    <input type="text" name="search">
    <input type="submit" name="submit">
        </form>
    </body>
    </html>
    <?php
    $con = new PDO("mysql:host=sql300.epizy.com;dbname=epiz_24872058",'yLzTqP0MzhWpmNs','');
    if (isset($_POST["submit"])) {
        $str = $_POST["search"];
        $sth = $con->prepare("SELECT * FROM `search` WHERE Name = '$str'");
        $sth->setFetchMode(PDO:: FETCH_OBJ);
        $sth -> execute();
        if($row = $sth->fetch())
        {
            ?>
            <br><br><br>
            <table>
                <tr>
                    <th>Name</th>
                    <th>Description</th>
                </tr>
                <tr>
                    <td><?php echo $row->Name; ?></td>
                    <td><?php echo $row->Description;?></td>
                </tr>
    
            </table>
    <?php 
        }
            
            
            else{
                echo "Name Does not exist";
            }
    
    
    }
    
    
    
    ?>
    
    

  2. #2
    scusa, ma tu cosa faresti se uno ti dicesse: guardami 'sto codice che non funziona?

  3. #3
    La vera domanda è: scusa ma tu che faresti se uno ti dicesse: scusa, ma tu cosa faresti se uno ti dicesse: guardami 'sto codice che non funziona?

  4. #4
    Che cavolo di domanda è scusa? ovviamente lo aiuterei...
    Quote Originariamente inviata da optime Visualizza il messaggio
    scusa, ma tu cosa faresti se uno ti dicesse: guardami 'sto codice che non funziona?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.