应该从查询返回值的函数

时间:2017-09-10 18:51:27

标签: php sql

我有这个函数用于从查询中获取值。我可能在执行或语法方面做错了。当我尝试使用其中的数据运行查询时,它很好,但是这个返回0项。

public function get_modified_event ($type, $id, $employee_id)
        {
            global $dbh;
            $sql =<<<SQL

                    SELECT outlook_id 
                        FROM dba.events
                    WHERE spine_item_type = :type
                    AND spine_id = :id
                    AND employee_id = :employee_id 
SQL;

            $stmt = $dbh->prepare( $sql );
            $stmt->execute( array(
                    'id' => $id,
                    'type' => $type,
                    'employee_id' => $employee_id,

            ) );
                    $rows = $stmt->fetchAll( \PDO::FETCH_ASSOC );
                    return $rows['outlook_id'];
        }

1 个答案:

答案 0 :(得分:0)

您可以尝试重新编写部分代码,以便它使用这种格式:

<!-- App/Page resources -->
<ResourceDictionary>
    <ControlTemplate x:Key="ThreeBorderBtn">
        <Grid RowSpacing="0" ColumnSpacing="0" Margin="0">
            <BoxView Margin="5" BackgroundColor="Purple" />
            <BoxView Margin="10" BackgroundColor="Green" />
            <BoxView Margin="15" BackgroundColor="Red" />
            <ContentPresenter Margin="20" />
        </Grid>
    </ControlTemplate>
</ResourceDictionary>

<!-- Control usage -->
<!-- make sure to register xmlns:local namespace --> 
<local:TemplatedButton 
    HeightRequest="100"
    Text="Button Caption!" 
    TextColor="Teal" 
    Command="{Binding ClickCommand}"
    BackgroundColor="White"
    ControlTemplate="{StaticResource ThreeBorderBtn}" />

希望你能得到一些有意义的结果。