liebewinter: phpmyadmin nicht start

Beitrag lesen

jetz habe meine datebank mit phpmyadmin gebaut,

datenbank

mit diesen Code,

<?php


class ClassProveContakt3 
{

      private $Name;
      private $Email;
      private $Message;
      private $PostOK;
      private $DateTime;
      private $items;
      private $ips;
      
      

 
    function __construct() 
    {

         $this -> ips = $_SERVER['REMOTE_ADDR'];
         $this -> DateTime = date('m/d/Y h:i:s a');  
         $this -> items = ['Name', 'Email', 'Message']; 

         
         
         
         $flag = true;
          foreach ( $this -> items as $key ) {  
			           if ( empty ( $_POST[$key] ) )  {
			             $flag = false;    
			           } else {    
			             $this -> $key = trim( filter_var( $_POST[$key], FILTER_SANITIZE_STRING ) ); 
			            }    
		   }	     
         $this -> PostOk = $flag; 
         
    }

 
    

  
    function ShowForm() 
    {
?>
      <form  method="POST">
        <label for="name"><b>Name * </b></label>
        <input type="text" id="name" name="Name" value="">
        <label for="email"><b>E-mail * </b></label>
        <input type="email" id="email" name="Email" value="">
        <br><br>
        <label><b> Message * </b><br>
           <textarea cols="45" rows="6" id="text" name="Message"></textarea>      
        </label>
        <br><br>
        <input  type="submit" name="post" value="POST COMMENT" id="comment">
      </form>
<?php
    }
    function PostOkT() 
    {
             if (! $this -> PostOK)
             {
               echo "<br><b><h3>*** Please enter all required fields ***</h3></b>";  
             } 
             else 
             {
               
               

                 $this->writeCommentToDatabase(); 

                 $messages = $this->getMessages();

                 foreach ($messages as $message)
                 {
?>
<article>
   <h2>Message from <?= htmlspecialchars($message['name']) ?> (<?= htmlspecialchars($message['email'])?>)</h2>
   <p>Created <?= $message['datetime'] ?></p>
   <p><?= $message['message'] ?></p>
</article>
<?php
                 
                     
               }    
             }     
     }
     function writeCommentToDatabase()
     {
      // 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;
      }

      //Prepare Query of SQL
      $statement = $db->prepare("INSERT INTO mela(name, email, message, datetime, ips) VALUES (:name, :email, :message, :date, :ips)");
      if (!$statement)
      {
         echo "<br><br>prepare failed: SQLSTATE=" . $db->errorCode() . ", Error Info=" . print_r($dbh->errorInfo(), true) . "</p>";
         $ok = FALSE;
      }
      else
      {
         $ok = $statement->bindValue(':name', $this->Name, PDO::PARAM_STR)
            && $statement->bindValue(':email', $this->Email, PDO::PARAM_STR)
            && $statement->bindValue(':message', $this->Message, PDO::PARAM_STR)
            && $statement->bindValue(':date', date("Y-m-d H:i:s"), PDO::PARAM_STR)
            && $statement->bindValue(':ips', $this->ips, PDO::PARAM_STR);
         if (!$ok)
         {
            echo "<br><br>bindValue failed: SQLSTATE=" . $db->errorCode() . ", Error Info=" . print_r($dbh->errorInfo(), true) . "</p>";
         }
      }
      if ($ok)
      {
         $ok = $statement->execute();
         if (!$ok)
         {
            echo "<br><br>execute failed: SQLSTATE=" . $db->errorCode() . ", Error Info=" . print_r($dbh->errorInfo(), true) . "</p>";
         }


      }
      echo "<br/><br/><span>Data Inserted successfully...!!</span>";
       $this->db = null;
       return $ok;


    }    
    function getMessages()
    {
        $db = getConnection();
        if (!$db)
        {
            return false;
        }

        $sql = "SELECT name, email, message, datetime FROM mela ORDER BY datetime DESC";
        $statement = $db->query($sql);

        if (!$statement)
        {
            $this->reportPDOError("Cannot create query", $sql, $db);
            return false;
        }

        $result = $statement->fetchAll(PDO::FETCH_ASSOC);

        if ($result === FALSE)
        {
            $this->reportPDOError("fetchAll(ASSOC) failed", $sql, $statement);
        }
        return $result;
         
    }
    function getConnection() 
    {
          // Establish connection with MYSQL Server
          try
          {
             return new PDO("mysql:host=localhost;dbname=meine", "root", "pass");
          }
          catch (PDOException $pe)
          {
             echo "<br>Cannot connect to database: " . $pe->getMessage();
             return false;
          }
      }

      private function reportPDOError($message, $sql, $pdo)
      {
         $info = $pdo->errorInfo();

         echo "<div style='color:red'><b>Error in SQL Access: $message</b>";
         echo "<br>SQL-Statement: $sql";
         echo "<br>PDO SQLSTATE: $info[0]";
         echo "<br>MySQL error code: $info[1]";
         echo "<br>MySQL error message: $info[2]</div>";
      }
     
}
            
$Newobject = new ClassProveContakt3();
$Newobject -> ShowForm();
$Newobject ->  PostOkT(); 
$Newobject -> getConnection();



    

?>

aber wenn füllen alles bekomme nichts weder auf der Website noch Datenbank

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