Get all the data from INNER JOIN

Asked

Viewed 146 times

3

My problem is that I’m doing a query but I’m not able to list all the data in the table.

SELECT * FROM suporte s
INNER JOIN login l ON l.cliente_id = s.cliente_id
INNER JOIN radius_acct r ON r.USERNAME = l.user
WHERE s.CLOSEDATA = '0000-00-00 00:00:00' AND r.ACCTSTOPTIME = '00-00-0000 00:00:00' limit 50;

When I put <td ><?php echo $linha['opendata']; ?></td> works normally, but the data that is right in the query is not displayed. Ex: <td class="cliente1"><?php echo $linha['acctstarttime']; ?></td> get back to me

Notice: Undefined index: acctstarttime in D: www teste index.php on line 76.

Does anyone know what might be causing this problem ?

  • I can not understand well. how so "right of the query"? put the code (at least from line 70 until 76 which is where gives the error)

1 answer

0


Try this,

SELECT suporte.*, login.*, radius_acct.* FROM suporte
INNER JOIN login ON login.cliente_id = suporte.cliente_id
INNER JOIN radius_acct ON radius_acct.USERNAME = login.user
WHERE suporte.CLOSEDATA = '0000-00-00 00:00:00' AND radius_acct.ACCTSTOPTIME = '00-00-0000 00:00:00' limit 50;

This way we are selecting everything from the three tables

  • I tried but appeared Error: 1054 Description: Unknown column’s. CLOSEDATA' in 'Where clause'

  • @Leonehenrique wants to select all login table and right support table data?

  • right, it worked the query, inside mysql shows me all the columns I need but I still can’t get the data of some columns. The first column works normally but the last column is returned to me error Notice: Undefined index: acctstarttime in D: www test index.php on line 73

  • Check it out now @Leonehenrique, with this edition I made

  • still remains the same error, I think it may be some limitation of INNER JOIN.

  • Are you sure the column name is spelled right? Have you tried how it looks on @Leonehenrique? It’s ACCTSTOPTIME from the right radius_acct table?

  • yes the name is right, already tried with other columns, I can get the data of the table login and support, but the table radius_acct does not go at all.

  • @Leonehenrique, have you tried as I have on top? It’s strange because I’m selecting everything from the three tables

  • Yes I tried exactly how you passed me,, already tried with the column acctstarttime, acctstoptime and username that are in radius_acct and will not, if I put the user column that is in the login table but has the same username content that this in radius_acct works normally. OBS: The query is working, the problem is to take the data.

  • Ask the question how you are extracting and try to display the data in PHP @Leonehenrique

  • I came to apologize because the problem was really the name, for some reason only in this table I have to put exactly Acctstarttime, ie if put acctstarttime or ACCTSTATTIME as I did in the other tables does not work.

  • hehe @Leonehenrique, no problem if the answer helped you should accept it, to the left of the answer under the up/down arrows. Welcome to OS PT

Show 7 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.