* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
<?php
// create connection to database
$host = "webdev.iyaserver.com";
$userid = "dent_student";
$userpw = "code4Studentuse";
$db = "dent_movies";
$mysql = new mysqli(
$host,
$userid,
$userpw,
$db);
if($mysql->connect_errno) {
echo "db connection error : " . $mysql->connect_error;
exit();
}
// base query
$sql = "SELECT * from view1 WHERE 1=1";
// ADD ON FILTER
$sql .= " AND label LIKE 'Dream%' ";
// ADD ON sort order
$sql .= " ORDER BY title";
// submit query to database, store returned data as $results
$results = $mysql->query($sql);
if(!$results) {
echo "SQL error: ". $mysql->error . " running query <hr>" . $sql . "<hr>";
exit();
} else {
// put sql into comment block of webpage
echo "<!-- SQL: $sql -->";
}
/*
Note: $results is a database "result set".
It has a property $results->num_rows that is a number (how many rows of data)
*/
// Code to output one sample row with list of columns
$sample = $results->fetch_assoc();
echo "<!-- Sample first row of data <br>";
print_r($sample);
echo "</pre> -->";
$results->data_seek(0); // reset results
// close php block
?>
<html>
<head>
<title></title>
<style>
body { background-color:steelblue; width: 600px; margin:auto;}
h3 { background-color: lightsteelblue; color:steelblue; text-align:center; }
</style>
</head>
<body>
<h3>Dreamworks Films</h3>
<?= $results->num_rows ?>
Dreamworks films
<hr>
<?php // BACK into php
// create output loop around rows of database results
while( $currentrow = $results->fetch_assoc() ) { // OPEN/active php loop
// while in repeating loop, back into html mode
?>
<strong><?= $currentrow["title"] ?></strong>,
Rated <?= $currentrow["rating"] ?>
(<em><?= $currentrow["genre"] ?></em>)
<br>
<?php } ?>
</body>
</html>