Question: I'm trying to add selected data row from mysql db into a html table.  

In fact i can select data and show it in console but I don't know how to add it in html page.  

**here is my js code**

```
var mysql = require('mysql');

var con = mysql.createConnection({
  host: "localhost",
  user: "root",
  password: "",
  database: "mydb"
});

con.connect(function(err) {
  if (err) throw err;
  //Select all customers and return the result object:
  con.query("SELECT * FROM customers", function (err, result, fields) {
    if (err) throw err;
    console.log(result);
  });
});

```

Answer: 
You should use a `ConstraintLayout` which is more efficient:

```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/linear_1"
        android:layout_width="0dp"
        android:layout_height="24dp"
        android:background="@android:color/black"
        android:orientation="horizontal"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <android.support.v7.widget.RecyclerView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@android:color/holo_blue_bright"
        app:layout_constraintBottom_toTopOf="@+id/linear_2"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/linear_1"/>

    <LinearLayout
        android:id="@+id/linear_2"
        android:layout_width="0dp"
        android:layout_height="24dp"
        android:background="@android:color/black"
        android:orientation="horizontal"
        app:layout_constraintBottom_toTopOf="@+id/grid_view"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"/>

    <GridView
        android:id="@+id/grid_view"
        android:layout_width="0dp"
        android:layout_height="24dp"
        android:background="@android:color/holo_green_dark"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>

```

And add `compile 'com.android.support.constraint:constraint-layout:1.0.2'` to your gradle file.

It looks like this
[![](https://i.stack.imgur.com/IqlAN.png)](https://i.stack.imgur.com/IqlAN.png)

black -> LinearLayout

blue -> RecyclerView

green -> GridView
Use align attributes
--------------------

To place a childLayout at the top in RelativeLayout use `alignParentTop = "true"`  

To place a childLayout at the bottom in RelativeLayout use `alignParentBottom = "true"`  

In your case give above attributes in your child LinearLayouts respectively . And to make sure RecyclerView lays below the First LinearLayout Use this attribute in your RecyclerView `android:layout_below = "@id/LinearLayout"`