In PHP am pus:
Cod: Selectaţi tot
<?php
$comandaSQLprog= 'SELECT DISTINCT cu.ziua,cu.ora_start,cu.locuri,cu.textore,cu.salaactiid, vi.datavinz,vi.dataexp, p.progore
from culegore cu
left join
(select distinct pr.orai, ifnull(sum(pr.progore),0) as progore, pr.salaid from programare pr inner JOIN sala s ON pr.salaid=s.sala_id inner JOIN activitati ac ON pr.activitid=ac.activ_id where ac.acactiv="ACTIV" and pr.dataprog="2015-03-04" and s.sala_id=4 and ac.activ_id=14 group by pr.orai) p on p.orai=cu.ora_start
inner JOIN oferterep orep ON cu.salaactiid=orep.salactid
inner JOIN vinzari vi ON orep.oferteid=vi.oferteid
inner JOIN sala_acti sa ON cu.salaactiid=sa.salacti_id
inner JOIN sala s ON sa.salaid=s.sala_id
inner JOIN activitati a ON sa.activitid=a.activ_id where
(a.acactiv="ACTIV" and s.sala_id=4 and a.activ_id=14 and cu.ziua="Miercuri" and vi.clientid=366 and vi.datavinz<="2015-03-04" and vi.dataexp>="2015-03-04")
group by cu.ora_start';
$res = mysql_query($comandaSQLprog) or die(mysql_error());
$re_html ='';
$id=0;
$i=0;
$re_html .='<table id="tabelsursa" name="tabelsursa" class="show" style="position:absolute;padding: 0px; line-height: 9px;left: 10px; top:380px;" >';
$re_html .='<tbody>';
$re_html .='<tr>';
$re_html .='<td colspan="5" style="text-align: center;background-color: #C2C2C2;">Programare</td>';
$re_html .='</tr>';
$re_html .='<tr>';
$re_html .='<td style="width: 10px;background-color: #C2C2C2;">Ziua</td>';
$re_html .='<td style="width: 10px;background-color: #C2C2C2;">Ora start</td>';
$re_html .='<td style="width: 10px;background-color: #C2C2C2; ">Total locuri</td>';
$re_html .='<td style="width: 10px;background-color: #C2C2C2;">Ocupate</td>';
$re_html .='<td style="width: 10px;background-color: #C2C2C2;">Rezervare (1 ora)</td>';
$re_html .='</tr>';
while($rand = mysql_fetch_assoc($res)) {
$re_html .='<tr >';
$re_html .='<td >'.$rand["ziua"].'</td>';
$re_html .='<td >'.$rand["ora_start"].'</td>';
$re_html .='<td >'.$rand["locuri"].'</td>';
$re_html .='<td >'.$rand["progore"].'</td>';
if ($oreefe<$nrore && strlen($d>0)){
if(($rand['locuri']>$rand['progore']) && ($d<=$datalimita) ) {
$id=$rand["ora_start"];
$re_html .='<input type="hidden" id="a'.'$i'.'" value="'.$id.'">';
$re_html .='<td value="18"><a href="#" onclick="clicrezervare(this);" class="confirmation" id="confirmation" >Rezerva_loc_'.$id.'</a></td>';
}}
$re_html .='</tr>';
$i++;
}
$re_html .='</tbody>';
$re_html .='</table>';
$re_html .='<br/><br/>';
$re_html .='<label style="position:absolute;left:100px;top:550px;visibility: visible; font-size:36px; " id="labe" name="labe" >'.$_SESSION['dataprog'].'</label><br/>';;
echo $re_html;
?>
Interesant este ca nici pe server nu da eroare de fiecare data. Daca ies din aplicatie si intru din nou cu Login a doua oara (sau a treia oara) merge. Daca intru in BD (care este numai pe server) cu phpMyAdmin si pun acest sir intr-un query merge de fiecare data. Nesiguranta asta ma deranjeaza.
- Sirul este obtinut cu echo, de fapt el arata asa:
Cod: Selectaţi tot
<?php
$comandaSQLprog= 'SELECT DISTINCT cu.ziua,cu.ora_start,cu.locuri,cu.textore,cu.salaactiid,
vi.datavinz,vi.dataexp,
p.progore
from culegore cu
left join
(select distinct pr.orai, ifnull(sum(pr.progore),0) as progore, pr.salaid
from programare pr
inner JOIN sala s ON pr.salaid=s.sala_id
inner JOIN activitati ac ON pr.activitid=ac.activ_id
where ac.acactiv="ACTIV" and pr.dataprog='.'"'.$d.'"'.' and s.sala_id='.$x.' and ac.activ_id='.$y.'
group by pr.orai)
p on p.orai=cu.ora_start
inner JOIN oferterep orep ON cu.salaactiid=orep.salactid
inner JOIN vinzari vi ON orep.oferteid=vi.oferteid
inner JOIN sala_acti sa ON cu.salaactiid=sa.salacti_id
inner JOIN sala s ON sa.salaid=s.sala_id
inner JOIN activitati a ON sa.activitid=a.activ_id
where (a.acactiv="ACTIV" and s.sala_id='.$x.' and a.activ_id='.$y.' and cu.ziua='.'"'.$ziua.'"'.'
and vi.clientid='.$z.' and vi.datavinz<='.'"'.$d.'"'.' and vi.dataexp>='.'"'.$d.'"'.')
group by cu.ora_start';
?>
Edit: pe timpul testelor voi pastra echo-ul la sirul SQL pana la aparitia erorii, apoi voi vedea ce este in sir. Cred ca e prea greu de identificat acum cauza.