note 111567 deleted from reserved.variables.get by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:58:03 +0000 |
| Subject: | note 111567 deleted from reserved.variables.get by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210842@lists.php.net to get a copy of this message | ||
Note Submitter: Z80user
----
in MySQLi
I need write
-. $_GET[actor]
instead of
-. $_GET["actor"]
or
-. $_GET['actor']
NOTE: IIS 7.5 (On Windows Server 2008 R2 Datacenter) with PHP Version 5.4.12 and mysqlnd 5.0.10
Version of MySQL 5.6.10
This code show a Movies with an actor ID_Actor
E.G. URL "http://127.0.0.1/test2.php?actor=14"
<?php
// CONNECT TO THE DATABASE
$DB_HOST = '';
$DB_USER = '';
$DB_PASS = '';
$DB_NAME = '';
$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
// A QUICK QUERY ON A FAKE USER TABLE
$query = "SELECT DISTINCT Title FROM movie WHERE ID_movie IN ( SELECT DISTINCT ID_Movie FROM
actor_scene WHERE ID_actor=$_GET[actor]) ";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
// GOING THROUGH THE DATA
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo stripslashes($row['Title'])."<br>";
echo " ";
}
}
else {
echo 'NO RESULTS';
}
// CLOSE CONNECTION
mysqli_close($mysqli);
?>