-
Notifications
You must be signed in to change notification settings - Fork 5
/
fungsi.php
73 lines (70 loc) · 2.05 KB
/
fungsi.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
$user = "u1786488_fuzzy";
$password = "GT7tz=U]u(Iz";
$database = "u1786488_fuzzybank";
mysql_connect("localhost",$user,$password) or die(mysql_error());
mysql_select_db($database);
function gettabu($tabel){
$query = "select * from $tabel";
$result=mysql_query($query) or die(mysql_error());
while($list=mysql_fetch_array($result)){
$a[] = $list['jml_atm'];
}
return $a;
}
function getdata($tabel,$id){
$query = "select * from $tabel where jml_atm='$id'";
$result=mysql_query($query) or die(mysql_error());
$list=mysql_fetch_array($result);
//$num = mysql_num_rows($result);
return $list;
}
function getdata2($tabel){
$query = "select * from $tabel";
$result=mysql_query($query) or die(mysql_error());
$i=0;
while($list=mysql_fetch_array($result)){
for($j=0;$j<mysql_num_fields($result);$j++){
$namafield = mysql_field_name($result, $j);
$data[$i][$namafield] = $list[$j];
}
$i++;
}
//$num = mysql_num_rows($result);
return $data;
}
function getdata3($tabel,$id){
$query = "select * from $tabel where id_care = '$id'";
$result=mysql_query($query) or die(mysql_error());
$i=0;
while($list=mysql_fetch_array($result)){
for($j=0;$j<mysql_num_fields($result);$j++){
$namafield = mysql_field_name($result, $j);
$data[$i][$namafield] = $list[$j];
}
$i++;
}
//$num = mysql_num_rows($result);
return $data;
}
function send($nama,$password,$alamat,$telp){
$query = "insert into user values
('','$nama','$password','$alamat','$telp','','')";
$result = mysql_query($query) or die(mysql_error());
}
function sign($nama,$password){
$query = "select * from user where nama = '$nama' AND password = '$password' ";
$result=mysql_query($query) or die("Query Failed ".mysql_error());
if(mysql_num_rows($result)<=0) return false;
$i=0;
while($list=mysql_fetch_array($result)){
for($j=0;$j<mysql_num_fields($result);$j++){
$namafield = mysql_field_name($result, $j);
$data[$i][$namafield] = $list[$j];
}
$i++;
}
//$num = mysql_num_rows($result);
return $data;
}
?>