berechnen.php
PHP-Code:
<?php
if (!empty($zahl1) and !empty($zahl2))
{
$db_server = 'localhost';
$db_user = 'root';
$db_passwort = '';
$zahl1=$_GET['zahl1'];
$zahl2=$_GET['zahl2'];
$ergebnis= $zahl1 + $zahl2 ;
$db_link = mysql_connect ($db_server, $db_user, $db_passwort);
if (!$db_link)
{
die ('keine Verbindung möglich: ' . mysql_error());
}
$sql = 'use iron';
$result = mysql_query($sql, $db_link);
if (!$result)
{
die ('Ungültige Abfrage: ' . mysql_error());
}
$sql = 'INSERT INTO maxx ';
$sql .= '(id, Zahl1, Zahl2, Ergebnis) ';
$sql .= "values ('Null', '$zahl1', '$zahl2', '$ergebnis')";
$result = mysql_query($sql, $db_link);
if (!$result)
{
die ('Ungültige Abfrage: ' . mysql_error());
}
echo "alles paletti das ergebnis ist $ergebnis" ;
}
else
{
die('nix übergeben');
}
?>