I am trying to use str_to_date function with mysql but I want to do this through a shell. I have found the -e parameter and I tried to do it by assigning a variable number from the outside in the loop but it works but the sql syntax error can be corrected. delirium if you indicate an error in my explanations
MY CODES
#!/bin/bash
kullanici='burak';
sifre='testdb';
tablo='testtab';
echo -n 'Lutfen gununu sayi olarak girin (orn 24) : '
read gununu
echo -n 'Lutfen zaman aralıgının kactan baslayacagını girin (orn 8) : '
read kactan
echo -n 'Lutfen zaman araligini kacar kacar artacagını girin (orn 15) : '
read kacar
echo -n 'Lutfen kacta bitecegini girin (orn 45) : '
read bitecegini
echo -n 'Lutfen girise baslanacak saati girin (orn 9) : '
read saati
echo -n 'Lutfen eklenecek sektör kodunu girin (orn 1012101) : '
read eklenecek
tbl=$tablo
for (( i=$kactan; i<=$bitecegini; i=i+$kacar )); do
## SQL PROMPT ##
mysql -u $kullanici -p$sifre -D u8184144_data -e "INSERT INTO '$tablo'('poliklinik_kodu', 'randevu_bas') VALUES ($eklenecek,str_to_date('$gununu 2018 $saati $kacar','%d %M %Y %H %i'));"
done
note: why can not I add it with the -e parameter? :)