Database Data to Download Variables

Gets data from a MySql database, splits the data into separate columns, then uses one column in a URL to download something – and uses other column to name the file thats downloaded

for i in (mysql -u root Project_Madapp -sNe 'SELECT CONCAT(id,",",name) AS yo FROM City WHERE type="actual"'); do parts=({i//,/ }); wget -O "{parts[1]}.csv" "http://localhost/student_allocation_csv.php?format=csv&city_id={parts[0]}"; done

Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

1 thought on “Database Data to Download Variables

  1. for i in *; do mysql -u root -sNe “create database (basenamei ‘.sql’)”; mysql -u root (basenamei ‘.sql’) < $i; done

    This will create the database – and then import the necessary data into it.

Leave a Reply

Your email address will not be published. Required fields are marked *