-
Notifications
You must be signed in to change notification settings - Fork 39
/
register_username.php
38 lines (31 loc) · 1007 Bytes
/
register_username.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* @author Piyush
* @copyright 2012
*/
require ("header.php");
global $db;
$partial = $_GET['pt'];
switch ($_GET['action']) {
case "register":
$query = $db->query("select * from member where membername like '%$partial%' and username='' and password=''");
$usernames = array();
while ($row = $db->fetch($query)) {
$usernames[$row["id"]] = $row['membername'];
}
//for ($temp=0; $temp<count($usernames))
echo json_encode($usernames);
break;
case "search":
$query = $db->query("select * from member where membername like '%$partial%' and membername not IN ('Mother', 'Father', 'Wife')");
$usernames = array();
while ($row = $db->fetch($query)) {
$usernames[$row["id"]] = array("name" => $row['membername'],"familyid" => $row['family_id']);
}
//for ($temp=0; $temp<count($usernames))
echo json_encode($usernames);
break;
default:
break;
}
?>