How to retrieve the data from the sever and displaying it in a page?

So in this case, the problem is that your line right before the echo call is incomplete:

$number_rows= $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->daviddgl_wp1.SaveContactForm7_7" );
$x=1;
while ($x<$number_rows) {
    $results = $wpdb->get_results("SELECT ticket, name,email FROM $wpdb->daviddgl_wp1.SaveContactForm7_7 WHERE id = $x");
    print_r($results);
    $x++;
}

(You’re missing the closing bracket and semi-column)

Note also that your echo will not work here, since $results will be an array. You’ll probably want to use var_dump or print_r – like I did in the above example.

Hope this helps!