-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmediaMrpKeygen.php
41 lines (33 loc) · 986 Bytes
/
mediaMrpKeygen.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
<?php
//mediaMrpKeyGen($handle) genera un progressivo univoco
//nella tabella mediabank
//ritorna il progressivo generato
//attenzione questo file contiene anche la funcione build_query_media_ins
function mediaMrpKeyGen($handle)
{
$qymediamax = "SELECT MAX(`n_ord`) AS `maxcod` FROM `mediabank`";
$qrisult=mysqli_query($handle,$qymediamax);
if (mysqli_num_rows($qrisult) > 0)
{
$rnext = mysqli_fetch_row($qrisult);
$next = $rnext[0];
$next++;
} else
{
$next = 1;
}
mysqli_free_result($qrisult);
return $next;
}
//build_query_media_ins() genera e ritorna la query string per inserire
//un record nella tabella mediabank
function build_query_media_ins($bq_codice,$bq_progr,$bq_tmpfile)
{
$the_query = "INSERT INTO mediabank (codice, n_ord, file, descrizione) VALUES (".
"'".$bq_codice ."',".
"'".$bq_progr."',".
"'".basename($bq_tmpfile)."',".
"'"."file archiviato il ".date('dmY')."')";
return $the_query;
}
?>