如何在php查询中插入冗长的语句?

I need to insert a lengthy statement (see below) into a query.

$q = 
    'SELECT vh12915_fleet.systemHistory.systName, vh12915_space.stars.x, vh12915_space.stars.y
    FROM vh12915_fleet.systemHistory
    INNER JOIN vh12915_space.stars
    ON vh12915_fleet.systemHistory.systName = vh12915_space.stars.name 
    WHERE vh12915_fleet.systemHistory.fleetName = "Fl"';

The statement I provided is error-free, as it has been tested in phpMyadmin and worked.

However, when put into a script it produces an error.

What is the right way to put a lengthy statement into a query? Why does this exact statement work in phpMyAdmin, and not in the script?

With php script

$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

    $q = '
    SELECT vh12915_fleet.systemHistory.systName,
           vh12915_space.stars.x,
           vh12915_space.stars.y

    FROM vh12915_fleet.systemHistory
        INNER JOIN vh12915_space.stars
        ON vh12915_fleet.systemHistory.systName = vh12915_space.stars.name

    WHERE vh12915_fleet.systemHistory.fleetName = "Fl"';

    $result = $mysqli->query($q);
    // use result

Documentation