Add weight parameter in a custom module I created a content type and it has many nodes. And I wrote a custom module to show nodes on the front page.

My nodes order:

 $themeurl = '/drupal/'.path_to_theme().'/images';
    $sql = "SELECT * FROM `node`
            LEFT JOIN `field_data_field_anasayfa_catwalk` ON `field_data_field_anasayfa_catwalk`.`entity_id` = `node`.`nid`
            WHERE type = 'designers_albums'
            AND `node`.`status` = 1
            AND `node`.`language` = '".$language-&gt;language."'
            AND `field_data_field_anasayfa_catwalk`.`field_anasayfa_catwalk_value` = 1
            ORDER BY `node`.`created` ASC";


But now, I installed the Weight module and want to sort by weight. How can I change this option?
Thank you.
You'll just have to add another JOIN to the weight_weights table on your query.

The weight_weights table stores the entity_id, entity_type and the weight value.

EDITED

Here goes an example:

$sql = "SELECT * FROM `node`
        LEFT JOIN `field_data_field_anasayfa_catwalk` ON `field_data_field_anasayfa_catwalk`.`entity_id` = `node`.`nid`
        LEFT JOIN `weight_weights` ON `weight_weights`.`entity_id` = `node`.`nid`
        WHERE type = 'designers_albums'
        AND `node`.`status` = 1
        AND `node`.`language` = '".$language-&gt;language."'
        AND `field_data_field_anasayfa_catwalk`.`field_anasayfa_catwalk_value` = 1
        ORDER BY `weight_weights`.`weight` ASC";