Wpis z mikrobloga

#mysql #pytanie #php

Proszę o pomoc kogoś kto ogarnie ten syf :)
Jak wczytać z tabeli "userid" tylko ID o numerach 27 i 65 ?

$query = "select c.name,sum(a.dayturnover),b.turnover,sum(a.dayenters),sum(a.daybills),b.efficiency,b.enters,b.workdays,count(a.id),c.id,b.asort1,b.asort2,b.asort3,b.asort4,b.asort5,b.asort6,sum(a.asort1),sum(a.asort2),sum(a.asort3),sum(a.asort4),sum(a.asort5),sum(a.asort6)
from sale_saloon_data as a, sale_planned_values as b, sale_users as c
where c.id=a.user_id and c.id=b.user_id and c.id!=$_SESSION[userId] and a.year=$year and a.month=$month and b.month=$month and b.year=$year";
if (isRegion()){
$query .= " and c.parent_id=".$_SESSION['userId'];
}
$query .= " group by c.id";
$res = mysql_query($query, $connection);
$rows = mysql_num_rows($res);
  • 10
@mariecziek: A napiszesz mi dokładnie gdzie dodać to WHERE c.id IN (27, 65) php to nie moja bajka ja bardziej w html i CSS

where c.id=a.user_id and c.id=b.user_id and c.id IN (27, 65) and a.year=$year and a.month=$month and b.month=$month and b.year=$year";
if (isRegion()){
@wordpress_developer: Ok działa :) Powinno być tak
( ͡° ͜ʖ ͡° )*:

where c.id IN (27, 65) and c.id=a.user_id and c.id=b.user_id and c.id!=$_SESSION[userId] and a.year=$year and a.month=$month and b.month=$month and b.year=$year";