how to insert a data into database using android studio and phpmyadmin(wampserver)?

I have an example of similar thing for saving username and password,try modifying according to your idea. The process is very similar. //Layout of Activity <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:padding=”2dp” tools:context=”com.test.test.ScreenOne”> <EditText android:layout_width=”240dp” android:layout_height=”wrap_content” android:id=”@+id/etUsername” android:layout_marginTop=”150dp” android:hint=”username” android:layout_alignParentTop=”true” android:layout_centerHorizontal=”true” /> <EditText android:layout_width=”240dp” android:layout_height=”wrap_content” android:id=”@+id/etPassword” android:hint=”password” android:layout_below=”@+id/etUsername” android:layout_centerHorizontal=”true” /> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” … Read more

how to compare the two fields in php with different table in mysql?

Assuming that you have a time_in column in the table time_in if($stmt = $dbconnect->prepare(“SELECT time_in from time_in”)){ $stmt->bind_param(“s”, $time_in); $stmt->execute(); $cur_time = time(); if($time_in === $cur_time){ echo “Teacher is on time”; } } This is mainly an idea about how things should be going. There’s always room for improvement. To be precise, you should give … Read more

If two columns are 1 then make new column

Your query would be: SELECT PRESENT, WHOLEDAY, CASE WHEN (PRESENT = 1 AND WHOLEDAY = 1) THEN 1 WHEN (PRESENT = 1 AND WHOLEDAY = 0) THEN 0.5 ELSE 0 END as ATTENDANCE FROM MY_TABLE Case Syntax is : CASE WHEN condition_1 THEN commands WHEN condition_2 THEN commands … ELSE commands END CASE;