php mysql绑定到参数

I am newbee and want to learn about php, got below code from google.

Not understand this line of the code.

What is the meaning of this line of code $where = ($data_id) ? 'WHERE id = :data_id' : '';

is it mean, if $data_id is not empty than set variable $where to WHERE id = (param data_id)?

How about if i want to change it to WHERE id like (param data_id) ?

<?php
    include 'db.php';
    $id = (isset($_GET['uid'])) ? $_GET['uid'] : NULL;

    getById($id);

     function getById($data_id) {
         $where = ($data_id) ? 'WHERE id = :data_id' : '';
         $sql="SELECT * from tbl_user $where ORDER BY id desc";
         try {
             $db = getDB();
             $stmt = $db->prepare($sql);
             $stmt->bindParam("data_id", $data_id);
             $stmt->execute();
             $listed = $stmt->fetchAll(PDO::FETCH_OBJ);
             $db = null;
             echo '{"data": ' . json_encode($listed ) . '}';
         } catch(PDOException $e) {
             echo '{"error":{"text":'. $e->getMessage() .'}}';
         }
     }
?>