-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworld.php
More file actions
53 lines (38 loc) · 876 Bytes
/
world.php
File metadata and controls
53 lines (38 loc) · 876 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
mysql_connect(
"0.0.0.0",
"kimmie01"
);
mysql_select_db("world");
$LOOKUP = $_REQUEST['lookup'];
# execute a SQL query on the database
if($_REQUEST['all'] == 'true')
{
$results = mysql_query("SELECT * FROM countries");
print $results;
}
else
{
$results = mysql_query("SELECT * FROM countries WHERE name LIKE '%$LOOKUP%';");
}
print $results;
# loop through each country
while ($row = mysql_fetch_array($results)) {
?>
<li> <?php echo $row["name"]; ?>, ruled by <?php echo $row["head_of_state"]; ?> </li>
<?php
}
/*$xml = new XMLWriter();
$xml->openURI("php://output");
$xml->startDocument();
$xml->setIndent(true);
$xml->startElement('countrydata');
while ($row = mysql_fetch_assoc($results))
{
$xml->startElement("country");
$xml->writeRaw($row['name']);
$xml->writeRaw($row['ruler']);
$xml->endElement();
}
$xml->endElement();*/
?>