Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/public_html/acad274/
File Upload :
Current File : /home/dent/public_html/acad274/movies_labexercise.php

<?php

// create connection to database
$host = "webdev.iyaserver.com"; // database server address
$userid = "dent_student"; // database user account name
$userpw = "code4Studentuse"; // database user password
$db = "dent_movies"; // database name

$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 ";

//  potentially add to $sql with additional WHERE filters like
// $sql .= " AND column  = 'data' OR column like '%term%'";

// potentially add a sort order clause
// $sql .= " ORDER BY columnname";

$results = $mysql->query($sql);

if(!$results) {
    echo "SQL error: ". $mysql->error . " running query <hr>" . $sql . "<hr>";
    exit();
}
// close php block
?>




<!-- below code outputs number of records in query. Use in html block -->
<?= $results->num_rows ?>




<!-- following block creates an output loop. It requires that you have already created a query
and stored it in php variable $results -->
<?php
while( $currentrow = $results->fetch_assoc() ) { // OPEN/active php loop
?>
        <!-- normal html and text, with php output blocks for column values -->
        <?= $currentrow["columnname"] ?>

<?php
    } // end php loop
?>