Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
u1_insert [2017-10-27 13:51]
Joakim Forsgren
u1_insert [2018-11-09 13:41]
Joakim Forsgren
Line 39: Line 39:
 // 2. Säg till databasen att man vill ha ut resultatet i utf8 // 2. Säg till databasen att man vill ha ut resultatet i utf8
 mysqli_set_charset($link, "utf8"); mysqli_set_charset($link, "utf8");
-  
- 
    
 /* /*
Line 47: Line 45:
  */  */
 if (!empty($_POST['Item'])) { if (!empty($_POST['Item'])) {
-$query="INSERT INTO `Items` (+  $query="INSERT INTO `Items` (
   `ItemID` ,   `ItemID` ,
   `Item` ,   `Item` ,
   `Date`   `Date`
-+  
-VALUES (+  VALUES (
   NULL , '" . $_POST['Item'] . "', NOW( )   NULL , '" . $_POST['Item'] . "', NOW( )
-)+  )";
-";+
   mysqli_query($link,$query);   mysqli_query($link,$query);
   header('location: ' . basename($_SERVER['SCRIPT_NAME']));   header('location: ' . basename($_SERVER['SCRIPT_NAME']));
Line 75: Line 72:
   </form>   </form>
   <h3>Mina items</h3>   <h3>Mina items</h3>
-<?+<?php
 // 3. Ställ en fråga // 3. Ställ en fråga
 $query="SELECT * FROM Items ORDER BY Date DESC"; $query="SELECT * FROM Items ORDER BY Date DESC";