note 111567 added to reserved.variables.get
| From: | Z80user | Date: | Mon, 04 Mar 2013 23:40:43 +0000 |
| Subject: | note 111567 added to reserved.variables.get | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193897@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 69.147.83.199
Probable Submitter: 80.103.189.190
----
Manual Page -- http://php.net/manual/en/reserved.variables.get.php
Edit -- https://master.php.net/note/edit/111567
Del: integrated -- https://master.php.net/note/delete/111567/integrated
Del: useless -- https://master.php.net/note/delete/111567/useless
Del: bad code -- https://master.php.net/note/delete/111567/bad+code
Del: spam -- https://master.php.net/note/delete/111567/spam
Del: non-english -- https://master.php.net/note/delete/111567/non-english
Del: in docs -- https://master.php.net/note/delete/111567/in+docs
Del: other reasons-- https://master.php.net/note/delete/111567
Reject -- https://master.php.net/note/reject/111567
Search -- https://master.php.net/manage/user-notes.php