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.

Speichern und Sortieren von Datum

Empfohlene Antworten

Veröffentlicht

Hallo Forum

ich versuche folgendes:

Datum wird per Formular eingegeben. Datum in Datenbank speichern, Datum anschließend sortiert auf Webseite ausgeben.

Für manche ist das bstimmt super simpel, bin aber blutiger Anfänger. Hab schon diverse Dokus gelesen schnall das aber nicht wirklich....wer kann mir da helfen?

Gruß

Jens

hmmmm, und wie bekomme ich das Datum in die Datenbank???

Mein Formular setzt sich aus Tag-Monat-Jahr zusammen.

Hallo

Ja, es ist MySQL.

Hab inzwischen schon hin und her versucht....klappt einfach nicht.

Hier mal der Code:


<form action="formular1.php" method="post" target="">


<select name="tmonate" size="">

<option value="1">Januar</option>

</select>Monat<br>


<select name="ttage" size="">

         <option>1</option>

  <option>2</option>

  <option>3</option>

  <option>4</option>

  <option>5</option>

  <option>6</option>

  <option>7</option>

  <option>8</option>

  <option>9</option>

  <option>10</option>

  <option>11</option>

  <option>12</option>

  <option>13</option>

  <option>14</option>

  <option>15</option>

  <option>16</option>

  <option>17</option>

  <option>18</option>

  <option>19</option>

  <option>20</option>

  <option>21</option>

  <option>22</option>

  <option>23</option>

  <option>24</option>

  <option>25</option>

  <option>26</option>

  <option>27</option>

  <option>28</option>

  <option>29</option>

  <option>30</option>

  <option>31</option>

</select>Tag   <br>


       <select name="tjahre" size="">

         <option>2006</option>

  <option>2007</option>

  <option>2008</option>

  <option>2009</option>

</select>Jahr    <br>

       <input type="Text" name="ttourinfos" value="" size="" maxlength="">Tourinfos  <br>

       <input type="Text" name="twwwadresse" value="" size="" maxlength="">www-Adresse    <br>


       <input type="Submit" name="" value="Kann noch nicht verschickt werden!">      <br>

        </form>

<?php

$host = "datenbankserver"; // Adresse des Datenbankservers, meistens localhost

$user = "Nutzername"; // Ihr MySQL Benutzername

$pass = "mypasswort"; // Ihr MySQL Passwort

$db = "DBxxxx"; // Name der Datenbank

?>


<?php

$tmonate = $_POST['tmonate'];

$ttage = $_POST['ttage'];

$tjahre = $_POST['tjahre'];

$ttourinfos = $_POST['ttourinfos'];

$twwwadresse = $_POST['twwwadresse'];

$link = mysql_connect($host, $user, $pass) or die ("Keine Verbindung zu der Datenbank möglich.");

mysql_select_db($db, $link);

//$sql_eintrag = "INSERT INTO tourdaten (tmonate, ttage, tjahre, ttourinfos, twwwadresse) VALUES ('$tmonate', '$ttage', '$tjahre', '$ttourinfos', '$twwwadresse')";

//$eintrag = mysql_query ($sql_eintrag) or die("Fehler: ".mysql_error());


$insertSQL = sprintf("INSERT INTO tourdaten (datum) VALUES ('%s-%s-%s')", $tjahr, $tmonat, $ttag);

$eintrag = mysql_query ($insertSQL) or die("Fehler: ".mysql_error());


?>



Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.