Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evo-calendar with MySql-Database #1

Closed
eberhardst opened this issue Feb 12, 2020 · 7 comments
Closed

evo-calendar with MySql-Database #1

eberhardst opened this issue Feb 12, 2020 · 7 comments
Labels
good first issue Good for newcomers question Further information is requested

Comments

@eberhardst
Copy link

Hey Edlyn Villegas,
many thanks for your great work.
Is there a way to connect the calendar to a mysql database?
Best wishes
Eberhard

@edlynvillegas
Copy link
Owner

edlynvillegas commented Feb 13, 2020 via email

@edlynvillegas edlynvillegas added good first issue Good for newcomers question Further information is requested labels Feb 13, 2020
@realjimjim
Copy link

@eberhardst it work with PHP well if you echo your database value with php inside the javascript where it marking the event, then it will work like a charm!

@eberhardst
Copy link
Author

Hello realjimjim, do you have any example?
best regards
Eberhard

@realjimjim
Copy link

realjimjim commented Feb 24, 2020

@eberhardst

as you can see from the example:

{ name: "New Year", date: "Wed Jan 01 2020 00:00:00 GMT-0800 (Pacific Standard Time)", type: "holiday", everyYear: true },
{ name: "Valentine's Day", date: "Fri Feb 14 2020 00:00:00 GMT-0800 (Pacific Standard Time)", type: "holiday", everyYear: true },
{ name: "Patient #1", date: "2020-01-30", type: "event" },
{ name: "Patient #3", date: "February/3/2020", type: "event" },
{ name: "Patient #4", date: "February/3/2020", type: "event" },
{ name: "Holiday #3", date: "February/3/2020", type: "holiday" },
{ name: "Birthday #2", date: "February/3/2020", type: "birthday" },
{ name: "Author's Birthday", date: "February/15/2020", type: "birthday", everyYear: true },
{ name: "Holiday #4", date: "February/15/2020", type: "event" },
{ name: "Patient #2", date: "February/8/2020", type: "event" },
{ name: "Leap day", date: "February/29/2020", type: "holiday", everyYear: true }

just fetch the data from your database and echo it here using php, for example here i using foreach to replace the example code, you can use for loop or while loop too:

foreach ($query->result() as $key) {
echo '{ name: "'.$key->name.'", date: "'.$key->date.'", type: "'.$key->type.'", everyYear:'.$key->yearly.' }',
}

anyway this is just one of the many method, you can use any other better method than mine for apply.

:)

@baaaun
Copy link

baaaun commented Jun 23, 2020

@eberhardst

como puedes ver en el ejemplo:

{nombre: "Año Nuevo", fecha: "Mié 01 de enero de 2020 00:00:00 GMT-0800 (hora estándar del Pacífico)", escriba: "vacaciones", cada año: verdadero},
{nombre: "Día de San Valentín", fecha : "Vie 14 de febrero de 2020 00:00:00 GMT-0800 (hora estándar del Pacífico)", escriba: "vacaciones", cada año: verdadero},
{nombre: "Paciente n.º 1 ", fecha: "2020-01-30" , escriba: "evento"},
{nombre: "Paciente n.º 3 ", fecha: "febrero / 3/2020", escriba: "evento"},
{nombre: "Paciente n.º 4 ", fecha: "febrero / 3 / 2020 ", escriba:" evento "},
{nombre:" Vacaciones # 3 ", fecha:" 3 / febrero / 2020 ", escriba:" vacaciones "},
{nombre: "Cumpleaños # 2 ", fecha: "3 / febrero / 2020", tipo: "cumpleaños"},
{nombre: "Cumpleaños del autor", fecha: "15 / febrero / 2020", tipo: "cumpleaños", cada año: verdadero},
{nombre: "Vacaciones # 4 ", fecha: "15 / febrero / 2020", escriba: "evento"},
{nombre: "Paciente # 2 ", fecha: "8 de febrero / 2020", tipo: "evento"},
{nombre: "Día bisiesto", fecha: "29 de febrero / 2020", tipo : "vacaciones", cada año: verdadero}

simplemente obtenga los datos de su base de datos y repítalos aquí usando php, por ejemplo, aquí estoy usando foreach para reemplazar el código de ejemplo, puede usar for loop o while loop también:

foreach ($ query-> result () como $ key) {
echo '{name: "'. $ key-> name. '", date: "'. $ key-> date. '", type: "'. $ key-> type. '", everyYear:'. $ key-> annual. ' } ',
}

de todos modos, este es solo uno de los muchos métodos, puede usar cualquier otro método mejor que el mío para aplicar.

:)

hi, you hace the example in JS,becouse i have the json in php, but the function eventcalendar doesnt work

@baaaun
Copy link

baaaun commented Jun 23, 2020

Iam Calling the event like this ---> 'calendarEvents': 'calendar.php'
but when execute doesnt work the error is : Event named: "undefined" doesn't have a unique ID but the json is ;

[{"id":14,"name":"sdfsdf","date":"2020/06/23","type":"event","everyYear":"false"},{"id":9,"name":"Eliminar los fallidos","date":"2020/06/23","type":"event","everyYear":"false"},{"id":11,"name":"TAREA LEO","date":"2020/06/23","type":"event","everyYear":"false"},{"id":12,"name":"Prueba dsfsdf","date":"2020/06/23","type":"holiday","everyYear":"false"},{"id":8,"name":"ingreso datos nuevo cliente","date":"2020/06/23","type":"holiday","everyYear":"false"}]

whats is wrong ??

@edlynvillegas
Copy link
Owner

Hello @baaaun, 😄 I tried the JSON you provided and it worked perfectly.. Kindly check how you return the JSON from that file calendar.php
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants