0

I have this code:

$status_kol=trim($v->Status);
$mojakolicina = "Raspoloživo";

if($status_kol=="Raspoloživo"){

$status_dobavljivosti=2;

    }
    else {

        $status_dobavljivosti=0;
         }

         echo "OVO JE ZA dostupnost : $status_dobavljivosti <br/>\n";

But i alway get 0 And I get 3 when status_kol is not "Raspoloživo"?

Can you help me with this?

Thans

Edited by mehnihma: 4

2
Contributors
5
Replies
6
Views
4 Years
Discussion Span
Last Post by diafol
0

All the time I get when 0 never 2 for Raspoloživo
I dont get it
And when I print out lenght of string $v->Status I get 12 but it is 11?

0

There is somewhere worng encoding set in my php, but I cannot get where

0

I am getting worng encoding here I think but why?

    foreach($xml as $k=>$v){
        $b="";
        if($i==0){
            foreach($v as $k1=>$v1){
                $head[]=$k1;
            }
            array_push($head,"meta_description","meta_tag","tax","supplier","quantity","price");
            foreach($head as $k4=>$v4){
                $b.= "$v4".DELIMITER;
            }
        }//echo $xml->$k->BrojArtikla."=>".$xml->$k->Image."<pre>".print_r($head,1)."</pre>";
        foreach($head as $k3=>$v3){
            if($v3=='meta_description'){$v3='Naziv';}

            if(empty($v->$v3) or $v->$v3=="" or !isset($v->$v3)){
                $v->$v3="|||";
            }
            if($v3=='tax'){
                $b.=TAX.DELIMITER;
                $v->$v3=TAX;
            }elseif($v3=='supplier'){
                $b.=$supplier_name.DELIMITER;
                $v->$v3=$supplier_name;
            }elseif($v3=='quantity'){
                if($v->Status=='Raspoloživo'){
                //if($v->Status=='Raspoloživo'){
                    $b.="2".DELIMITER;
                    $v->$v3=2;
                }else{
                    $b.="0".DELIMITER;
                    $v->$v3=0;
                }
0

Here you say $v is an array:

foreach($v as $k1=>$v1){
   $head[]=$k1;
}

Then it's an object:

$v->$v3

Is it both?? Confused.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.