Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

vielleicht erkennt Ihr ja, an was es liegt, dass mein PHP-Programm keine Daten in die Datenbank (MySQL) schreibt, es kommt auch keinerlei Fehlermeldung !?

--------------------

<?php

$myHostname = "localhost";

$myUsername = "user";

$myPassword = "password";

$myDB = "database";

$mytable = "table";

$dbConnection = mysql_connect( $myHostname, $myUsername, $myPassword );

if (!$dbConnection)

{

die('Keine Verbindung: ' . mysql_error());

}

mysql_select_db($myDB, $dbConnection);

$MACADDRESS = $_GET['MACADDRESS'];

$DRIVE = $_GET['DRIVE'];

$FREESPACE = $_GET['FREESPACE'];

$DATETIME = $_GET['DATETIME'];

if ( $_GET['save_data'] == "true" )

{

$sql = "INSERT INTO table (MACADDRESS, DRIVE, FREESPACE, DATETIME) VALUES ('" . $MACADDRESS . "','" . $DRIVE . "','" . $FREESPACE . "','" . $DATETIME . "')";

mysql_query($sql); }

else

{

$sql = "SELECT * FROM table;";

mysql_query($sql);

$result = mysql_query($sql, $dbConnection);

echo "<pre>";

while ($row = mysql_fetch_array($result))

{

print_r($row);

}

echo "</pre>";

}

mysql_close();

?>

-------------

Danke im Voraus.

Gruß

Backspace

Hallo,

eine Errorausgabe hatte ich bereits eingebaut, auch über diese wurde keine Fehlermeldung ausgegeben.

Das einzige was angezeigt wird, ist ein Balken beginnend bei 100%, am Ende des Balkens 1,011 und --.--K/s.

Mit anderen Worten, es werden keine Daten übermittelt.

Das DATETIME habe ich umbenannt auf DATETIMES.

Moin,

bau doch mal an einigen Stellen Ausgaben ein, damit man sieht, welche Programmteile durchlaufen werden, also z.B.


$myHostname = "localhost";
$myUsername = "user";
$myPassword = "password";
$myDB = "database";
$mytable = "table";

$dbConnection = mysql_connect( $myHostname, $myUsername, $myPassword );

if (!$dbConnection)
{
die('Keine Verbindung: ' . mysql_error());
}

//Hier eine Änderung
mysql_select_db($myDB, $dbConnection) or die("Fehler bei Selectdb");


$MACADDRESS = $_GET['MACADDRESS'];
$DRIVE = $_GET['DRIVE'];
$FREESPACE = $_GET['FREESPACE'];
$DATETIME = $_GET['DATETIME'];
if ( $_GET['save_data'] == "true" )
{
$sql = "INSERT INTO table (MACADDRESS, DRIVE, FREESPACE, DATETIME) VALUES ('" . $MACADDRESS . "','" . $DRIVE . "','" . $FREESPACE . "','" . $DATETIME . "')";
mysql_query($sql);
// Hier noch eine Änderung
echo "<HR>" . $sql . "<HR>";
}
else
{
$sql = "SELECT * FROM table;";
mysql_query($sql);
$result = mysql_query($sql, $dbConnection);

echo "<pre>";

while ($row = mysql_fetch_array($result))
{
print_r($row);
}

echo "</pre>";
// Ggf. in der php.ini mal Display_errors auf on setzeb
}

mysql_close();
[/PHP]

Bearbeitet von Reinhold

Hallo,

das Problem lag daran:

if ( $_GET['save_data'] == "true" ),

hatte vergessen das "save_data=true" in der batchdatei mitanzuhängen.

Gruß

Backspace

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.