Advertisement:

Author Topic: [Solved] b_company = 0 on query not working  (Read 170 times)

jonnyWeb

  • Newbie
  • *
  • Posts: 12
[Solved] b_company = 0 on query not working
« on: April 22, 2019, 11:10:03 pm »
Hi, b_company = 0 on query not working  :'(

Code: [Select]
$query = $dao->dao->query(sprintf("SELECT * FROM %st_user WHERE b_company = 0 ORDER BY dt_reg_date DESC LIMIT 4", DB_TABLE_PREFIX));
But using b_company = 1 working.

Some tricky to display normal users and not type company users only by sql query?
« Last Edit: April 23, 2019, 11:36:45 pm by jonnyWeb »

jonnyWeb

  • Newbie
  • *
  • Posts: 12
Re: b_company = 0 on query not working
« Reply #1 on: April 23, 2019, 10:48:10 pm »
Hey, nobody so far in answer.
@patrickfromcroatia, maybe you have some idea how to do it by sql query (statement inside to limit normal users)?

I don't want use a statement like this with php: <?php if (osc_user_field("b_company")==0){?>

I need do it directly on sql query to limite the query inself. I know this is possible, but why osclass opted to add a zero as value to normal users? No make any sense, 0 is zero, it return like a false or null value, comparing with value 1 will return true or value 1. Just can be this the reason it not working?

Thanks in advance

jonnyWeb

  • Newbie
  • *
  • Posts: 12
[Solved] Re: b_company = 0 on query not working
« Reply #2 on: April 23, 2019, 11:36:07 pm »
I'm so sorry... I forgot I have a function to not display users without picture. That's why not appeared results.
So, the condition and query is ok, working well now.

[Solved]