some AJAX test
bernd

bernd commited on 2008-09-18 15:49:23
Zeige 2 geänderte Dateien mit 50 Einfügungen und 0 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1151 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+require_once('inc/base.php');
4
+require_once('inc/debug.php');
5
+
6
+require_once('session/start.php');
7
+require_once('crm.php');
8
+
9
+require_role(ROLE_SYSADMIN);
10
+
11
+print_r($_GET);
12
+
13
+$result = array_unique(find_customer($_GET['q']));
14
+sort($result);
15
+foreach ($result as $val) {
16
+  echo '<p>Kundennummer: <strong>'.$val.'</strong></p>';
17
+}
18
+die();
19
+
20
+
... ...
@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+require_once('inc/base.php');
4
+
5
+
6
+function find_customer($string) 
7
+{
8
+  $string = mysql_real_escape_string(chop($string));
9
+  $return = array();
10
+  $result = db_query("SELECT id FROM kundendaten.kunden WHERE ".
11
+                     "firma LIKE '%{$string}%' OR firma2 LIKE '%{$string}%' OR ".
12
+                     "nachname LIKE '%{$string}%' OR vorname LIKE '%{$string}%' OR ".
13
+                     "adresse LIKE '%{$string}%' OR adresse2 LIKE '%{$string}%' OR ".
14
+                     "ort LIKE '%{$string}%' OR pgp_id LIKE '%{$string}%' OR ".
15
+                     "notizen LIKE '%{$string}%';");
16
+  while ($entry = mysql_fetch_assoc($result))
17
+    $return[] = $entry['id'];
18
+
19
+  $result = db_query("SELECT kundennr FROM kundendaten.kundenkontakt WHERE ".
20
+                     "wert LIKE '%{$string}%' OR name LIKE '%{$string}%';");
21
+  while ($entry = mysql_fetch_assoc($result))
22
+    $return[] = $entry['kundennr'];
23
+  
24
+  return $return;
25
+}
26
+
27
+
28
+
29
+
30
+
0 31