Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have the following code in a php page:

<?php

$query = "
    SELECT data 
    FROM table 
    WHERE param = 1 
";

Since this sql is wrapped inside quotations in a php document, everything shows up a solid green (or whatever color you have set for a string's syntax highlight).

Is there a way to get sublime text 2 to properly color the sql even with it inside a php string?

share|improve this question

2 Answers 2

On my Sublime this code works great:

$query = "SELECT data FROM table WHERE param = 1 ";

Don't add new line after '='

share|improve this answer

You will have to edit the PHP.tmLanguage located in Data\Packages\PHP. You should probably set a regex rule (as MySQL queries begin with SELECT/DESCRIBE etc.) and assign proper context.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.