Editor serverside php/Mysql
Editor serverside php/Mysql
stoads
Posts: 9Questions: 1Answers: 0
Hi, I'm new on dataTable Editor and I have a hard time using it.
I try to do the same sql request: 'SELECT DISTINCT datePrice FROM prices WHERE datePrice!=CURDATE() ORDER BY datePrice DESC LIMIT 3'
How can I do? Thanks
This discussion has been closed.
Answers
Hi,
I'm afraid you can't use a
DISTINCT
with Editor at this time, but you can use where conditions, as described here.Allan
Thanks Allan.
Can I do a where condition after a leftjoin or Not?
Yes - the documentation I linked to above shows how to do a
WHERE
condition, and that supports left joined tables.Allan
Hi Allan,
I try where condition but I have an error, here my code:
An error:
For information I want to group by article and only the last date or 3 past date.
Thanks.
I change where condition like this and for the last date it's work very well:
Remains to find for the last three dates...
I'm afraid I'm no SQL expert. A
select
statement with anorder by
andlimit
would be my approach, but for general SQL questions you might be best asking on StackOverflow or similar.Allan
Hi Allan,
the sql statement work find on php 5 and MySql but it's not the same with datatable.
It reading well but the writing not. I forgot something?
Just to confirm, the data read is working as you expect, but not the write? What do you expect to happen on the write? Can you link to the page so I can understand better what it is you are trying to achieve and what is going wrong please? I'm not quite getting it at the moment.
Thanks,
Allan
Hi Allan,
Did you receive my answer? I think I have a problem when sending my Post comment
I'm afraid the only information I've received is that shown above.
Allan
the php file:
Thanks for your help.
Thanks for the code. Could you possibly also answer my questions from above please:
Thanks,
Allan
Hi Allan,
On my page I can see the data send by the server. But when I change one value nothing to do just the date change but the where condition remove the past dates and I loose all that I want.
Is it possible to make the where condition only to the creation of the editor?
Thanks
As in when the data is fetched? Yes, you can use the
Editor::action()
method to determine if the action is get - e.g.:Allan
Ok I try this tomorrow.
And for set the new values I forgot Something?
I'm afraid I don't understand your last question. You asked about applying the
where
condition only when the Editor instance is created. I assumed you mean when the data is fetched.Could you clarify the issue - I'm afraid I'm not really understanding at the moment.
Allan
When I change value on cell I want to refresh the data base (SQL) and dataTable.
At this time, when I change one value on editor, the value is push on PHP file but nothing it's refresh.
JS code:
PHP code:
I don't know if I can use setValue?
At this time when I change a value cell on editor it don't refresh the data base (Sql) and the datatable.
here the code:
js file:
php file:
I don't know if I may use setValue or not?
Thanks.
At this time when I change a cell value on editor datatable it don't refresh the data base (sql) and the value on editor datatable.
here my code...
Hi Allan,
On write, I'm try to set the new value on data base (sql) but it don't work. Here my code.
At this time when I change a cell value on editor datatable it don't refresh the data base (sql) and the value on editor datatable.
here my code...