C
C
Chvalov2015-11-17 15:09:54
PHP
Chvalov, 2015-11-17 15:09:54

Where does the output come from if there was no post request and how to check if there was a post request?

There is a script:

if(isset($_POST['date']) && $_POST['date'] != '') {
        $result = ibase_query($dbh, 
                              "SELECT Stat.* FROM STATHIST Stat INNER join (SELECT UnitID, MAX(DtStat) as 
                              DtStat FROM STATHIST WHERE DtStat <= '".$_POST['date']."' GROUP BY UnitID) MaxD ON Stat.UnitID=MaxD.UnitID AND 
                              Stat.DtStat=MaxD.DtStat") or die (ibase_errmsg());
    } else {
        $result = ibase_query($dbh, "SELECT * FROM STATREAL") or die (ibase_errmsg());
    }

    $units = array();
    while($row=ibase_fetch_object($result)) {
        $units[] = $row;
    }

    foreach($units as $unit) {
        if(isset($units_coords[$unit->UNITID])) {
            $coords = 'style="top:'.$units_coords[$unit->UNITID][0].'px; left:'.$units_coords[$unit->UNITID][1].'px;"';
            //echo ($unit->UNITSTAT == 5) ? '<img src="/style/error.png" '.$coords.' class="icons">' : ($unit->UNITSTAT == 1) ? '<img src="/style/on.png" '.$coords.' class="icons">' : '';
            
            if($unit->UNITSTAT == 5)
                echo '<img src="/data/img/error.png" '.$coords.' class="icons">';
            if ($unit->UNITSTAT == 1)
                echo '<img src="/data/img/on.png" '.$coords.' class="icons">';
        }
    }

I didn’t send a post request, I just open the page, and it returns data to me, though not the ones I need.
There is only one solution here, to check for a post, whether it is empty and whether there was a request at all,
but I still don’t understand :(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wol_fi, 2015-11-17
@Chvalov

var_dump($_POST);

L
lLiquid, 2015-11-17
@lLiquid

What data does it return? Maybe it's worth posting all the original information?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question