~daniel-sonck/smdb/1.0

« back to all changes in this revision

Viewing changes to PHP/admin/providers/data/componists.php

  • Committer: Daniel Sonck
  • Date: 2012-05-30 00:22:57 UTC
  • Revision ID: daniel.sonck@ziggo.nl-20120530002257-exlbee8j0tov1e0z
PHP server side added

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
function load_data()
 
3
{
 
4
    global $table,$error;
 
5
    
 
6
    if (!isset($_GET['do']))
 
7
      $_GET['do'] = "";
 
8
 
 
9
    if($_GET['do'] == "delete")
 
10
    {
 
11
      $query = "DELETE FROM composers
 
12
                WHERE id = '{$_GET['id']}'";
 
13
      $result = mysql_query($query);
 
14
      if(!$result)
 
15
        $error[] = ('error in query ' . $query . ' ' . mysql_error());
 
16
    }
 
17
    if($_GET['do'] == "add")
 
18
    {
 
19
      if($_GET['id'] == 0)
 
20
      {
 
21
        $query = "REPLACE INTO composers (name)
 
22
                  VALUES('{$_GET['naam']}')";
 
23
        
 
24
      }
 
25
      else
 
26
      {
 
27
        $query = "UPDATE composers SET name='{$_GET['naam']}'
 
28
                  WHERE id='{$_GET['id']}'";
 
29
        
 
30
      }
 
31
      $result = mysql_query($query);
 
32
      if(!$result)
 
33
        $error[] = ('error in query ' . $game_query . ' ' . mysql_error());
 
34
      
 
35
    }
 
36
 
 
37
    $query = "SELECT * FROM composers";
 
38
    $result = mysql_query($query);
 
39
 
 
40
    if(!$result)
 
41
    {
 
42
      $error[] = ('error in query ' . $query . ' ' . mysql_error());
 
43
    }
 
44
    else
 
45
    {
 
46
      // PER REGEL
 
47
      for($i = 0;$row = mysql_fetch_assoc($result);$i ++) 
 
48
      {
 
49
        $table[$i] = $row;
 
50
      }
 
51
    }
 
52
}
 
 
b'\\ No newline at end of file'