I have 3 tables:
MENU
m_id
m_name (menu name)
m_content (content of the page)
m_p_id (plugin id)
m_s_id (status id)
m_id
m_name (menu name)
m_content (content of the page)
m_p_id (plugin id)
m_s_id (status id)
PLUGINS
p_id
p_name (plugin name, for example Gallery)
p_file (gallery.php)
p_id
p_name (plugin name, for example Gallery)
p_file (gallery.php)
STATUS
s_id
s_name (active or passive)
s_id
s_name (active or passive)
I would like to see these in an HTML table:
m_id
m_name
m_content
p_name
s_name
m_id
m_name
m_content
p_name
s_name
This is my query:
SELECT m_id, m_name, m_content, s_name,p_name
FROM menu, status, plugins
WHERE m_s_id=s_id AND m_p_id=p_id
The problem is, that I can't see the rows, where the m_p_id is empty(NULL in the column).
try that:
SELECT m_id, m_name, m_content, s_name, p_name
FROM menu
LEFT JOIN status ON m_s_id=s_id
LEFT JOIN plugins ON m_p_id=p_id
0 comments:
Post a Comment