Syntax higlighting bugs


#1

highlight-bugs

Hi guys, the mysqli code was all correct and it runs properly. But why atom highlights the $sql variable as green ? since there is no syntax error founded.


#2

If you want someone to look at that for you, you should post the relevant parts that still cause the issue as text. Make sure to fence it with ```
E.g.

```
Paste here
```

#3

The trouble starts with subjects(". The quote is seen as part of subjects.

How about using …

$sql  = "INSERT INTO subjects(menu_name, position, visible)
VALUES('$menu_name',$position,$visible)";
$result = mysqli_query($connection, $sql);

#4
<?php require_once('../includes/functions.php'); ?>
<?php require_once('../includes/db_connection.php'); ?>

<?php

if(isset($_POST["submit"])){

  $menu_name = $_POST["menu_name"];
  $position = (int) $_POST["position"];
  $visible = (int) $_POST["visible"];

  $sql  = "INSERT INTO subjects(";
  $sql .= "menu_name, position, visible";
  $sql .= ") VALUES(";
  $sql .= "'$menu_name', $position, $visible";
  $sql .= ")";
  $result = mysqli_query($connection, $sql);
  if($result){
    //success
    $message = "Subject created!";
    redirect_to('manage_content.php');
  }else{
    //failed
    $message = "Subject creation failed.";
    redirect_to('new_subject.php');
  }

}else{
  //GET request
  redirect_to('new_subject.php');
}

 ?>

#5

That’s a workaround, but not a fix to the actual problem.

@alianware I’d that bug in the repository of the language syntax. If you’re using the bundled one, that would be here.

Update: Looks like somebody already did report an issue for that: