how to get username from session and save in db in java code example

Example 1: get all db sizes in mysql server

SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema;

Example 2: how to store data with php

<?php
    //Get a secure filename so no one can get your server files
    $username = "myUsername"
    $filename = uniqid($username, true).".csv";
	//You can change the .csv file to a .txt

    //Create the array that stores data. You can replace what is below with what you want
    $userInfo = ["username" => $username, "points" => 0];

    // Store the data
    file_put_contents($filename, serialize($userInfo));

    // How to get the data
    $userInfo = unserialize(file_get_contents($filename));
    print($userInfo["points"]);
    // or
    print($userInfo["username"]);
	//Make sure that ^^^^ matches what is in the array
?>

Example 3: delete and start fresh with db django

Delete the sqlite database file (often db.sqlite3) in your django project folder (or wherever you placed it)
Delete everything except __init__.py file from migration folder in all django apps
Make changes in your models (models.py).
Run the command python manage.py makemigrations or python3 manage.py makemigrations
Then run the command python manage.py migrate.

Tags:

Php Example