-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg_read.php
More file actions
39 lines (28 loc) · 887 Bytes
/
msg_read.php
File metadata and controls
39 lines (28 loc) · 887 Bytes
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
<?php
include("msg_config.php");
$codice ="";
if (isset($_GET['codice'])) {
$codice = $_GET['codice'];
}
$con=mysql_connect('localhost',$DB_USER,$DB_PASS) or die("Attenzione! Non riesco a trovare il server");
mysql_select_db($DB_NAME,$con)or die("Attenzione! Non trovo il database");
if ($codice!="") {
$qResult = mysql_query ("SELECT * FROM msg WHERE codice='". $codice ."' ORDER BY id ASC");
if ($codice=="ALL") $qResult = mysql_query ("SELECT * FROM msg ORDER BY id ASC") ;
$nRows = mysql_num_rows($qResult);
$rString ="<msgs>";
for ($i=0; $i< $nRows; $i++){
$row = mysql_fetch_array($qResult);
$rString .= "<msg>"
. "<id>" . $row['id']. "</id>"
. "<codice>" . $row['codice'] . "</codice>"
. "<messaggio>" . $row['messaggio'] . "</messaggio>"
. "</msg>";
}
$rString .= "</msgs>";
echo $rString ;
}
else {
echo "<msgs></msgs>" ;
}
?>