Connector PHP with scheduler Problem

Hi,

i have the following problem:
2 tables (first: events, second: projekte)

and I have a field in the “projekte”-table (“unsichtbar”) which should show the events-table, that the events in that project should not be visible… The “events.id” is the primary field of the “events”-table.

My code is the following:

$scheduler->render_sql("SELECT events.event_name as label, events.start_date as value, events.end_date as value, events.details as label, events.welchesprojekt as value, events.rec_type as value, events.event_pid as value, events.event_length as value, events.userID as value, events.event_type as value, events.erstellungsdatum_event as value, projekte.unsichtbar as value FROM projekte INNER JOIN events ON projekte.projekt_id = events.welchesprojekt WHERE projekte.unsichtbar='0'","event_id","start_date(value),end_date(value),event_name(label),details(label),welchesprojekt(value),userID(value),event_type(value),erstellungsdatum_event(value)");
    

When I do this (in that case in combination with enabled live update), I get the error message

SELECT  * FROM actions_table LEFT OUTER JOIN projekte INNER JOIN events ON projekte.projekt_id = events.welchesprojekt ON actions_table.DATAID = projekte INNER JOIN events ON projekte.projekt_id = events.welchesprojekt.event_id WHERE ( projekte.unsichtbar='0') AND ( actions_table.ID > '212' AND actions_table.USER <> '1341428197148')

!!!Uncaught Exception
Code: 0
Message: MySQL operation failed
Not unique table/alias: 'events'

I can’t find out what I am doing wrong here…

Any help?

Thank you very much!
Martin

It looks as limitation of connector, we will check how existing code can be improved.
Meanwhile you can create a view based on the SQL code and user render_table with such view - it must work flawlessly.

Hi,

thank you for your answer!
Could you perhaps give me a short tip on how to do that? I can’t find anything on views in the documentation…

Sorry and thanks!
Martin

Hello,

For views you should check MySQL documentation:
dev.mysql.com/doc/refman/5.0/en/create-view.html

Or easier tutorial:
mysqltutorial.org/create-sql … mysql.aspx

Kind regards,
Ilya

Thank you!

This workaround with the view works fine in Chrome and Safari, but not in Firefox…

It is not dependent on your browser as all what needed from the server side is to generate correct XML file.

Try opening your “events.php” (you could name it differently) file in the browser - is XML displayed?
What kind of error do you get in Firefox?

Best regards,
Ilya

Thank you,

I have managed… strangely enough It depended on an “umlaut” in the database (but only with my firefox)…
Anyway that’s really strange. My database (Mysql) and the scheduler is utf8, but when I edit an event with an umlaut I have
ä
instead of ä

or
ü
instead of ü

in the database…

Best regards,
Martin

Check collation of database and collation of table - for better results all elements ( database, script, page ) need to use the same encoding ( utf8 is a good choice )

While sending data to server side, scheduler use unicode version of data escaping, so if you are using non-utf collation for database ( iso-8859-1 or similar ) - data can be saved incorrectly.