K
K
Konstantin Khairov2017-06-11 09:20:15
PHP
Konstantin Khairov, 2017-06-11 09:20:15

Help with SQL queries?

Hello everyone in DLE to display the {custom} tag in engine/modules/function.php
There is a separate SQL query. And here's the problem I ran into.
Added a module that added the actors field to the dle_posts table. Everything works fine, but I can’t add the output of this field for {custom} in any way, since the request for the entire function is collected via echo, I output the final request to the database

SELECT p.id, p.autor, p.date, p.actors, p.short_story, CHAR_LENGTH(p.full_story) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM dle_post p LEFT JOIN dle_post_extras e ON (p.id=e.news_id) WHERE category regexp '(43)' AND approve=1 AND date < '2017-06-11 07:51:58' ORDER BY date DESC LIMIT 0,5

There he is . As you can see, after p.id, p.autor, p.date, I immediately added p.actors so that it would also display data from this field. I check it in phpmyadmin, it takes it, but the problem is that the data in it is empty. I open the dle_posts table, the actors field of the topic being checked is filled, but if you make the request that is given above, this field will be displayed but will be empty. What could be the problem? How to compose this sql query so that it displays this field not empty. Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mletov, 2017-06-11
@mletov

The request appears to be correct.
1) Check again exactly those records that fall into the selection, preferably for specific IDs.
Perhaps this field is empty specifically for them.
2) What type of data is in the actors field? Maybe there's some kind of BINARY, or a string with specific ASCII characters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question