liebewinter: Kleine Verfeinerung der reportPDOError - Methode

Beitrag lesen

ich habe mit deine Vorschlag und bekomme alles Gut .

Kannst du Bitte Hilfe mit meine neue Probleme…

Ich habe eine neu Datei ,kommenter_verwalter.php ,

<?php
include 'classprove.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$New = new ClassProveContakt1();



class ClassProveContakt2 
{


        private $dbHost = 'localhost'; # Host der Datenbank
	    private $dbName = 'meine';      # Name der Datenbank
	    private $dbUser = 'root';      # Name phpmyadmin
	    private $dbPass = 'pass';      # Passwort

      
       private $Name;
       private $Email;
       private $Message;
       private $PostOK;
       private $datetime;
       private $items;
       private $ip; 




    function CommentToDatabase()
    {
        // Establish connection with MYSQL Server
       try
       {
         $db = new PDO("mysql:host=localhost;dbname=meine", "root", "pass");
       }
       catch (PDOException $pe)
       {
         echo "<br>Cannot connect to database: " . $pe->getMessage();
         return false;
       }
     
       if(isset($_POST["delete"])) {
         try {
               require classprove.php;
                
               $connection = new PDO($id, $name, $email, $message, $datetime, $ip);

               $id = $_POST["id"];

               $sql = "DELETE FROM mela WHERE id = :id";

               $statement = $connection->prepare($sql);
               $statement->bindValue(':id', $id);
               $statement->execute();

               $success = "User successfully deleted";
          }catch(PDOException $error) {
                 echo $sql . "<br>" . $error->getMessage();
          }
         
       } 
     }
     function tabelle() 
     {
        

       if ($sb) 
       {  
 
          echo "<table id='user' class='table table-bordered'>
             <tr>
              <th>id</th>
              <th>name</th>
              <th>email</th>
              <th>message</th>
              <th>datetime</th>
              <th>ip</th>
             </tr>";
    
           
   
            foreach ($sb as $row): 
       
                echo "<form action='classprove.php' method='post'>
              <tr>
                <td> '".$row["id"]."'</td>
                <td>'". $row["name"]."'</td>
                <td>'". $row["email"]."'</td>
                <td> '".$row["datetime"]."'</td>
                 <td> '".$row["ip"]."'</td>
                </tr>
              </form>"; 
              
                      endforeach;
    
     
         echo "</table>"; 
       }
      }
}

$Newobjects = new ClassProveContakt2();
$Newobjects -> tabelle();


?>

ich versuche mit diese Datei dass der Kommentar wird in einer Tabelle gezeigt , wie diesen Screenshot, wünsch ausgang kommentar

aber mit sudo tail -n0 -f /var/log/apache2/error.log /var/log/mysql/error.log

bekomme dieser warnung,

PHP Notice: Undefined variable: sb in /var/www/html/kommenter_verwalter.php on line 76

Die Warnung ich verstehe aber ich weiß nicht wie lösen kann....

0 94

phpmyadmin nicht start

liebewinter
  • datenbank
  1. 0
    Rolf B
    1. 0
      liebewinter
  2. 1
    ursus contionabundo
    1. 0
      liebewinter
      1. 0
        ursus contionabundo
      2. 0
        ursus contionabundo
        1. 0
          liebewinter
          1. 0
            ursus contionabundo
            1. 0
              liebewinter
              1. 0
                ursus contionabundo
                1. 0
                  liebewinter
                  1. 0
                    ursus contionabundo
                    1. 0
                      liebewinter
                      1. 0
                        ursus contionabundo
                        1. 0
                          liebewinter
                          1. 0
                            ursus contionabundo
                            1. 0
                              liebewinter
                              1. 1
                                ursus contionabundo
                                1. 0
                                  liebewinter
                                  1. 0
                                    ursus contionabundo
                                    1. 0
                                      liebewinter
                                      1. 0
                                        ursus contionabundo
                                  2. 0
                                    ursus contionabundo
                                    1. 0
                                      liebewinter
                                      1. 0
                                        ursus contionabundo
                                        1. 0
                                          liebewinter
                                          1. 0
                                            ursus contionabundo
                                            1. 0
                                              liebewinter
                                              1. 0
                                                liebewinter
                                                1. 0
                                                  ursus contionabundo
                                                  1. 0
                                                    liebewinter
                                                    1. 0
                                                      ursus contionabundo
                                                      1. 0
                                                        liebewinter
                                                        1. 0
                                                          ursus contionabundo
                                                          1. 0
                                                            liebewinter
                                                          2. 1

                                                            Es lag definitiv am PHP...

                                                            ursus contionabundo
                                                            1. 0

                                                              Was an der Kommentarfunktion konzeptionell schlecht ist

                                                              ursus contionabundo
                                                              1. 0
                                                                liebewinter
                                                                1. 0
                                                                  liebewinter
                                                                  1. 0
                                                                    liebewinter
                                                                    1. 0
                                                                      Tabellenkalk
                                                                    2. 0

                                                                      Altes Zeug löschen

                                                                      ursus contionabundo
                                                                      1. 0
                                                                        liebewinter
                                                                        1. 0
                                                                          liebewinter
                                                            2. 0
                                                              liebewinter
                                                              1. 0
                                                                liebewinter
                                                                1. 0

                                                                  Deine Datenbank-Tabelle ist wahrscheinlich (noch) falsch.

                                                                  ursus contionabundo
                                                                  1. 0
                                                                    liebewinter
                                                                    1. 0
                                                                      ursus contionabundo
                                                                      1. 0
                                                                        liebewinter
                                                                        1. 0
                                                                          ursus contionabundo
                                                                  2. 0
                                                                    liebewinter
                                                                    1. 0
                                                                      Rolf B
                                                                      1. 0
                                                                        liebewinter
                                                                        1. 0

                                                                          Auf dem Weg zum DELETE

                                                                          Rolf B
                                                                        2. 0

                                                                          Nein! Du machts jetzt einen Plan.

                                                                          ursus contionabundo
                                                                          1. 0
                                                                            liebewinter
                                                                      2. 0
                                                                        liebewinter
                                                                        1. 0
                                                                          Rolf B
                                                                          1. 0
                                                                            liebewinter
                                                                            1. 0
                                                                              Rolf B
                                                                              1. 0
                                                                                liebewinter
                                                                                1. 0
                                                                                  liebewinter
                                                                                  1. 0
                                                                                    Rolf B
                                                                                    1. 0
                                                                                      liebewinter
                                                                                    2. 0
                                                                                      liebewinter
                                                                                    3. 0
                                                                                      liebewinter
                                                                                      1. 0
                                                                                        Rolf B
                                                                                        1. 0
                                                                                          Matthias Apsel
                                                                                          • menschelei
                                                                                          1. 0
                                                                                            Rolf B
                                                                                        2. 0
                                                                                          liebewinter
                                                                                      2. 0

                                                                                        Tabelle wird nicht gezeigt

                                                                                        liebewinter
                                                                2. 0
                                                                  Rolf B
                                                                  1. 0

                                                                    Kleine Verfeinerung der reportPDOError - Methode

                                                                    ursus contionabundo
                                                                    • datenbank
                                                                    • php
                                                                    1. 0
                                                                      liebewinter
                                                                      1. 0
                                                                        ursus contionabundo
                                                                        1. 0
                                                                          MudGuard
                                                                        2. 0
                                                                          liebewinter
                                                                          1. 0
                                                                            ursus contionabundo
                                                                            1. 0
                                                                              liebewinter
                                                                              1. 0
                                                                                ursus contionabundo
                                                                                1. 0
                                                                                  liebewinter
                                                                                  1. 0
                                                                                    ursus contionabundo
                                                                                    1. 0
                                                                                      liebewinter
                                                                                      1. 0
                                                                                        ursus contionabundo
                                                                                        1. 0
                                                                                          liebewinter
                                                                                          1. 0
                                                                                            liebewinter
                                                      2. 0
                                                        liebewinter
                                                2. 0
                                                  liebewinter
                                                  1. 0
                                                    liebewinter
                                                    1. 0
                                                      ursus contionabundo
                        2. 0
                          ursus contionabundo
                          1. 0
                            liebewinter