Q: SQL query don't read data from database so I have two cursor that read data from database and write data to string, but cursors are always empty even if database have stored data. I checked with SQLite manager that database contain stored data.
Log Cat says that log named:"IF1" and "IF2 are executed.
Here is my code, I hope someone could find what's wrong..
String var;
final TextView t = (TextView) findViewById(R.id.textView2);
final TextView t2 = (TextView) findViewById(R.id.textView3);
Intent intent = getIntent();
var = intent.getStringExtra("datum");   

SQLiteDatabase db = openOrCreateDatabase ("MyDB", MODE_PRIVATE, null);

String q =" SELECT COALESCE (znak, '') as znak,COALESCE (sprava, '') as sprava, COALESCE(serija, '') as serija, COALESCE(podatak, '') as podatak, COALESCE(ponavljanja, '') as ponavljanja, vrijeme FROM tablica WHERE vrijeme LIKE '"+ var + "'" ;
Cursor c = db.rawQuery(q, null);      

String xy = "SELECT vrijeme FROM tablica WHERE vrijeme LIKE '"+ var + "'";
Cursor dd = db.rawQuery(xy, null);

if (dd.getCount() < 1) {
    Log.d("LIST.DETAILS", "IF1");
    dd.close();
    db.close();
    Toast.makeText(NapredakActivity.this, "Empty!", Toast.LENGTH_SHORT).show();
    startActivity(new Intent(this, calendar.class));
} else {
    String i = "";

    dd.moveToFirst();
    String st2 = dd.getString(dd.getColumnIndex("vrijeme"));
    i =  "Datum:" +"\t" + st2;
    t2.setText(i);
    dd.close(); 
}

if (c.getCount() < 1) {
    Log.d("LISTA.DETALJI", "IF2");
    c.close();
    db.close();
    Toast.makeText(NapredakActivity.this, "Empty!", Toast.LENGTH_SHORT).show();
    startActivity(new Intent(this, calendar.class));
} else {
    String j = "";

    c.moveToFirst();
    do {
        String cm55 = c.getString(c.getColumnIndex("sprava"));
        String cm = c.getString(c.getColumnIndex("serija"));
        String cm2 = c.getString(c.getColumnIndex("podatak"));
        String cm3 = c.getString(c.getColumnIndex("ponavljanja"));
        String cm_znak = c.getString(c.getColumnIndex("znak"));

        j = j +cm55+ "\n" + cm + "\t"  +cm2 +cm_znak + cm3 ;
    } while (c.moveToNext());

    t.setText(j);
    c.close();
    db.close();
}


A: I believe you are missing the wildcard characters from your WHERE clauses:
"vrijeme LIKE '%"+ var + "%'"

Otherwise:
"vrijeme LIKE '"+ var + "'"

Is the same as:
"vrijeme = '"+ var + "'"

Also I am guessing that English is not your first language, but your variable names are extremely cryptic. Consider using more descriptive names, it just helps the readability of your code.
