0

Hi,

I'm using InvisionPB to construct a query and basically generate a custom table. The following is what I have. I can get the query to echo prior to the switch/case but can't get it to display within the case itself. Any ideas?

$this->DB->build( array( 'select' => "m.name",
                                            'from'   => array('members' => 'm'),
                                            'add_join' => array( array('select' => 'p.position',
                                            'from'  => array('wt' => 'p'),
                                            'where' => "m.member_id = p.id",
                                            'type' => 'left',
                                            )
                                                    ),
        'having'        => 'p.position = 41',

                                                )

                                            );

        $this->DB->execute();
        $wt1 = $this->DB->fetch();

        // THIS ECHOS FINE HERE SO THE VALUE DOES EXIST BUT DOESN'T PASS TO THE SWITCH/CASE
        foreach($wt1 as $wt2) {
            echo rtrim($wt2, "41");
 }

    //


$x=$org;
switch ($x)
{
case hto:
        print ("<TABLE BORDER CELLPADDING=3>
            <TR ALIGN=CENTER VALIGN=TOP><br /><TH VALIGN=TOP COLSPAN='1'><center> HEAD");
        print ("</center><br /></TH></TR>");
        // VALUE DOES NOT PRINT BELOW IN TABLE
        print ("<td align='center'>$wt2</td>");
  break;

I've also had to use rtrim to trim the array output - which presents itself as an example as James41 (as if the 41 is being carried in to the array). The value within the "case" that prints is "41" - I lose the "James" part completely?

2
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by JayJ
0

Anybody able to assist with this at all? I've tried different ways of posting the variable but it just won't happen. Is this a limitation of using switch?

0

Thanks for the assistance. I worked out the day before what the issue was, which your solution would have assisted with diagnosing. I was pulling the value the wrong way (i.e. the join was a right join and I needed to switch the tables around or use a left join)

Many thanks

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.