Jump to content

Recommended Posts

Hi there, im new to programing and got a problem with my code, it wont connect to my MySQL Workbench on my PC and i dont know why.

<?php
include("dbconnect.php");
?>
!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!--Festlegung Website Titel-->
    <title>Auftragsübersicht dcl</title>
</head>
<body>
   <!--Festlegung Titel-->
    <h1>Auftragsübersicht</h1>
    <!--Öffnen Tabelle mit Größenangabe-->
    <table width="700" border="3" >
        <thead>
            <tr>
                <!--Festlegung der Ersten Zeile-->
              <th align=left width=350h>Abteilung</th><th align=left width=350>Offene Aufträge</th>
            </tr>
        </thead>
        <tbody>
            <tr>
               
              <td>Produktion</td><td>
                  <?php
                  $db = mysqli_connect("localhost", "Benutzername", "Passwort", "Datenbankname");
                  if(!$db)
                  {
                    exit("Verbindungsfehler: ".mysqli_connect_error());
                  }

                  // verbindung zur Datenbank
                 // Abfrage der Datensätze zur Produktion$res = mysql_query("SELECT arbeitsschrittname FROM auftrag WHERE arbeitsschrittname = 'Produktion'");

                 $num = mysql_num_rows($res);

                 echo "$num";

                  ?>

              </td>

            </tr>

            <tr>

                

                <td>Installation</td><td>   

                <?php

                // Abfrage der Datensätze zur Installation

                $res1 = mysql_query("SELECT arbeitsschrittname FROM auftrag WHERE arbeitsschrittname = 'Installation'");

                 $num1 = mysql_num_rows($res1);

                 echo "$num1";

                 ?>

                    </td>

            </tr>

            <tr>

                

                <td>Verpackung</td><td>

                <?php

                // Abfrage der Datensätze zur Verpackung

                    $res2 = mysql_query("SELECT arbeitsschrittname FROM auftrag WHERE arbeitsschrittname = 'Verpackung'");

                 $num2 = mysql_num_rows($res2);

                 echo "$num2";

                 ?>

 

Edited by Barand
code tags added
Link to comment
https://forums.phpfreaks.com/topic/313045-php-conection-to-mysql-workbench/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.