-
Notifications
You must be signed in to change notification settings - Fork 2
/
suggerimenti.php
102 lines (84 loc) · 2.33 KB
/
suggerimenti.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<script>
<?php
include("credenziali.php");
echo "$( function() {
var availableTags = [";
$conn2 = new mysqli($servername, $username, $password, $dbname);
$sql1 = "SHOW TABLES";
$table = $conn2->query($sql1);
if ($table->num_rows > 0) {
while($row = $table->fetch_assoc()) {
$tablename=$row['Tables_in_'.$dbname];
$richiedistruttura="SHOW COLUMNS FROM $tablename";
$struttura = $conn2->query($richiedistruttura);
echo "\"$tablename\",\n";
if ($struttura->num_rows > 0) {
while($row = $struttura->fetch_assoc()) {
foreach ($row as $value) {
echo "\"$tablename.$value\",\n";
echo "\"$value\",\n";
break;
}
}
} else {
echo "errore richiesta colonne tabelle";
}
}
} else {
echo "errore richiesta tabelle";
}
echo "\"SELECT\",
\"WHERE\",
\"GROUP BY\",
\"CREATE TABLE\",
\"INNER JOIN\",
\"ON\",
\"VARCHAR(n)\"
];";
$conn2->close();
?>
function split( val ) {
return val.split( /\s/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#tags" )
// don't navigate away from the field on tab when selecting an item
.on( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).autocomplete( "instance" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
minLength: 1,
autoFocus: true,
source: function( request, response ) {
// delegate back to autocomplete, but extract the last term
response( $.ui.autocomplete.filter(
availableTags, extractLast( request.term ) ) );
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( " " );
return false;
}
});
} );
</script>
<script>
$(function(){
$('textarea').autosize();
});
</script>