retrieve_user.php
Avoid using undefined variables such as '$db' which will lead to PHP notices. Open
Open
$results=$db->query($query);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid unused local variables such as '$db'. Open
Open
$results=$db->query($query);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
function id_to_position ($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
$id = select($operand, $condition, $email);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
function id_to_email ($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Expected "function abc(...)"; found "function abc (...)" Open
Open
function id_to_email ($id)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return $email;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$operand = 'position';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$position = select($operand, $condition, $id);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return $position;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
{
- Exclude checks
Expected 0 spaces before opening parenthesis; 1 found Open
Open
function id_to_email ($id)
- Exclude checks
Expected "function abc(...)"; found "function abc (...)" Open
Open
function email_to_id ($email)
- Exclude checks
Expected "function abc(...)"; found "function abc (...)" Open
Open
function id_to_position ($id)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
- Exclude checks
Expected 0 spaces before opening parenthesis; 1 found Open
Open
function email_to_id ($email)
- Exclude checks
Expected 0 spaces before opening parenthesis; 1 found Open
Open
function id_to_position ($id)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$condition = 'id';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $final[$operand];
- Exclude checks
End of line character is invalid; expected "\n" but found "\r\n" Open
Open
<?php
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$results=$db->query($query);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$final=mysqli_fetch_array($results);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
include('mysql_access.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$query = "SELECT $operand FROM contact_information WHERE $condition = '$value'";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$results->free();
- Exclude checks
Whitespace found at end of line Open
Open
{
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
$operand = 'email';
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
$email = select($operand, $condition, $id);
- Exclude checks
Whitespace found at end of line Open
Open
return $email;
- Exclude checks
Whitespace found at end of line Open
Open
function email_to_id ($email)
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
$id = select($operand, $condition, $email);
- Exclude checks
A closing tag is not permitted at the end of a PHP file Open
Open
?>
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
$condition = 'email';
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
return $email;
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
$condition = 'id';
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
?>
- Exclude checks
Whitespace found at end of line Open
Open
$condition = 'email';
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
return $id;
- Exclude checks
Whitespace found at end of line Open
Open
return $id;
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
Open
$operand = 'id';
- Exclude checks