Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我需要一些关于SQL或PHP的帮助,我不知道是哪个_Php_Mysql_Arrays_Activerecord_Codeigniter - Fatal编程技术网

我需要一些关于SQL或PHP的帮助,我不知道是哪个

我需要一些关于SQL或PHP的帮助,我不知道是哪个,php,mysql,arrays,activerecord,codeigniter,Php,Mysql,Arrays,Activerecord,Codeigniter,您好,我正在创建一个CMS,它的一些功能是,内容中的图像是可管理的。我目前正试图显示一个表格,显示内容标题,然后是相关图像,理想情况下,我希望类似的布局 内容标题 图1 图2 图3 内容标题2 图1 图2 内容标题3 图1 返回数据的SQL实际上是使用Codeigniters活动记录类形成的 function getAllContentImages() { $this->db->select('*'); $this->db->from('contentIm

您好,我正在创建一个CMS,它的一些功能是,内容中的图像是可管理的。我目前正试图显示一个表格,显示内容标题,然后是相关图像,理想情况下,我希望类似的布局

内容标题
图1
图2
图3
内容标题2
图1
图2
内容标题3
图1

返回数据的SQL实际上是使用Codeigniters活动记录类形成的

function getAllContentImages() {
    $this->db->select('*');
    $this->db->from('contentImagesTable');
    $this->db->join('contentTable', 'contentTable.contentId = contentImagesTable.contentId');
    $this->db->join('categoryTable', 'categoryTable.categoryId = contentTable.categoryId');

    $query = $this->db->get();
    return $query->result_array();
}
返回的数组如下所示,为了可读性,我已经减小了大小

    Array
(
    [0] => Array
        (
            [contentImageId] => 25
            [contentImageName] => green.png
            [contentImageType] => .png
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/2/green.png
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265222654
            [contentId] => 2
            [dashboardUserId] => 0
            [contentTitle] => sadsadsadassss
            [contentAbstract] => <p>Pllllleeeeeeeaaaaasssssseeeeee Work</p>
            [contentBody] => <p>Please work :-( please</p>
            [contentOnline] => 0
            [contentAllowComments] => 0
            [contentDateCreated] => 1265124038
            [categoryId] => 1
            [categoryTitle] => blogsss
            [categoryAbstract] => <p>asdsdsadasdsadfdsgdgdsgdsgssssssssssss</p>
            [categorySlug] => blog
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1266588327
        )

    [1] => Array
        (
            [contentImageId] => 28
            [contentImageName] => yellow.png
            [contentImageType] => .png
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/7/yellow.png
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265388055
            [contentId] => 7
            [dashboardUserId] => 0
            [contentTitle] => Another Blog
            [contentAbstract] => <p>This is another blog and it is shit becuase this does not work</p>
            [contentBody] => <p>ioasfihfududfhdufhuishdfiudshfiudhsfiuhdsiufhusdhfuids</p>

            [contentOnline] => 1
            [contentAllowComments] => 0
            [contentDateCreated] => 1265388034
            [categoryId] => 1
            [categoryTitle] => blogsss
            [categoryAbstract] => <p>asdsdsadasdsadfdsgdgdsgdsgssssssssssss</p>
            [categorySlug] => blog
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1266588327
        )

    [2] => Array
        (
            [contentImageId] => 33
            [contentImageName] => portaski.jpg
            [contentImageType] => .jpg
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/11/portaski.jpg
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265714175
            [contentId] => 11
            [dashboardUserId] => 0
            [contentTitle] => Portaski - new product and brand launch by Bang
            [contentAbstract] => <p>Bang's experience in new product development has helped launch PortaSki &ndash; the pocket-sized device which is set to revolutionise skiing.</p>
            [contentBody] => <p>After developing Portaski's brand identity and positioning, Bang re-designed the product and its packaging ahead of launch in late 2008.</p>
<p>A media and PR strategy was devised and implemented using Bang's close relationship with two of the UK's most influential organisations in the Advertising and Media Buying industries. On-line advertising was supported with editorial reviews in the UK's leading broadsheets and tabloids, which combined with pin-point HTML direct mail to drive consumers to the new e-commerce site.</p>

<p>Impressive month-on-month growth has been achieved since launch, and the direct marketing activity resulted in an unprecedented 2.71% of targets going on-line to purchase a PortaSki.</p>
<p>For further information visit <a href="http://www.portaski.com" target="_blank">www.portaski.com</a></p>
            [contentOnline] => 1
            [contentAllowComments] => 0
            [contentDateCreated] => 1265718184
            [categoryId] => 1
            [categoryTitle] => blogsss
            [categoryAbstract] => <p>asdsdsadasdsadfdsgdgdsgdsgssssssssssss</p>
            [categorySlug] => blog
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1266588327
        )

    [3] => Array
        (
            [contentImageId] => 26
            [contentImageName] => housingplus.jpg
            [contentImageType] => .jpg
            [contentImagePath] => /var/www/bangmarketing.bang/media/uploads/contentImages/5/housingplus.jpg
            [isHeadlineImage] => 1
            [contentImageDateUploaded] => 1265284989
            [contentId] => 5
            [dashboardUserId] => 0
            [contentTitle] => Bang launches Housing Plus
            [contentAbstract] => <p>Bang has launched Housing Plus, the new brand for the Central Borders Housing Group, along with new sub-brands Property Care and SSHA.</p>
            [contentBody] => <p>The Midlands based Group, with turnover in excess of &pound;21M, appointed Bang in 2008 following an open pitch of over 40 agencies. Bang's work began with an extensive marketing research strategy that challenged the Group's former positioning and brand structure.</p>

<p>The research unveiled that the housing sector demanded a values-led Group. This led Bang to develop the brave &lsquo;Together for the Right Reasons' positioning for Housing Plus.</p>
<p>Chris Garratt, Marketing Director at Bang explained "The housing sector has witnessed wholesale change in recent years. Much to tenant's dismay, many associations and Groups appear to be losing touch with their roots, we wanted to develop a Group for associations who place principles at the heart of their corporate strategy".</p>
<p>The repositioned sub-brands also play an important role in the Group's revised brand by highlighting Housing Plus' willingness to embrace and nurture individual identities. Chris Garratt continued "By adopting a &lsquo;house of brands' hierarchy from the outset, Housing Plus has sent out a strong message to prospective strategic partners".</p>
<p>Bang handled all aspects of work for the redevelopment of the three brands, including research, brand creation, naming, positioning, internal branding and communications, advertising, the brand launches, building the brands' on-line presence and the creation of a powerful brand film &ndash; which is already attracting significant interest from across the sector.</p>
            [contentOnline] => 1
            [contentAllowComments] => 0
            [contentDateCreated] => 1265285940
            [categoryId] => 8
            [categoryTitle] => News
            [categoryAbstract] => <p>The world at Bang Marketing moves fast, keep up to date w
            [categorySlug] => news
            [categoryIsSpecial] => 0
            [categoryOnline] => 1
            [categoryDateCreated] => 1265283717
        )
数组
(
[0]=>阵列
(
[contentImageId]=>25
[contentImageName]=>green.png
[contentImageType]=>.png
[contentImagePath]=>/var/www/bangmarketing.bang/media/uploads/contentImages/2/green.png
[isHeadlineImage]=>1
[ContentImageDateUpload]=>1265222654
[contentId]=>2
[dashboardUserId]=>0
[contentTitle]=>sadasss
[contentAbstract]=>PLLLLEEEEEEEAAASSSSEEEEEE工作

[contentBody]=>请工作:-(请

[contentOnline]=>0 [contentAllowComments]=>0 [contentDateCreated]=>1265124038 [类别ID]=>1 [categoryTitle]=>blogsss [categoryAbstract]=>ASDSADASADASADFDSGDGDSGDSGSSSSSS

[categorySlug]=>博客 [类别特殊]=>0 [categoryOnline]=>1 [categoryDateCreated]=>1266588327 ) [1] =>阵列 ( [contentImageId]=>28 [contentImageName]=>yellow.png [contentImageType]=>.png [contentImagePath]=>/var/www/bangmarketing.bang/media/uploads/contentImages/7/yellow.png [isHeadlineImage]=>1 [ContentImageDateUpload]=>1265388055 [contentId]=>7 [dashboardUserId]=>0 [contentTitle]=>另一个博客 [contentAbstract]=>这是另一个博客,它是狗屎,因为它不起作用

[contentBody]=>IOASFIHFUDFHDUFHUIHUDSHFIUDHSFIUHDSIUFHUSDHFUIDS

[contentOnline]=>1 [contentAllowComments]=>0 [contentDateCreated]=>1265388034 [类别ID]=>1 [categoryTitle]=>blogsss [categoryAbstract]=>ASDSADASADASADFDSGDGDSGDSGSSSSSS

[categorySlug]=>博客 [类别特殊]=>0 [categoryOnline]=>1 [categoryDateCreated]=>1266588327 ) [2] =>阵列 ( [contentImageId]=>33 [contentImageName]=>portaski.jpg [contentImageType]=>.jpg [contentImagePath]=>/var/www/bangmarketing.bang/media/uploads/contentImages/11/portaski.jpg [isHeadlineImage]=>1 [ContentImageDateUpload]=>1265714175 [contentId]=>11 [dashboardUserId]=>0 [contentTitle]=>Portaski-Bang发布的新产品和品牌 [contentAbstract]=>Bang在新产品开发方面的经验帮助推出了便携式设备PortaSki&ndash;,该设备将彻底改变滑雪运动

[contentBody]=>在开发了Portaski的品牌标识和定位后,Bang在2008年底发布之前重新设计了该产品及其包装

利用Bang与英国广告和媒体购买行业中两个最具影响力的组织的密切关系,设计并实施了一项媒体和公关战略。在线广告得到了英国领先的大报和小报的编辑评论的支持,并与pin-point HTML直邮相结合,以推动萨默斯来到新的电子商务网站

自上市以来,该公司实现了令人印象深刻的月环比增长,直接营销活动导致前所未有的2.71%的目标客户在线购买PortaSki

欲了解更多信息,请访问

[contentOnline]=>1 [contentAllowComments]=>0 [contentDateCreated]=>1265718184 [类别ID]=>1 [categoryTitle]=>blogsss [categoryAbstract]=>ASDSADASADASADFDSGDGDSGDSGSSSSSS

[categorySlug]=>博客 [类别特殊]=>0 [categoryOnline]=>1 [categoryDateCreated]=>1266588327 ) [3] =>阵列 ( [contentImageId]=>26 [contentImageName]=>housingplus.jpg [contentImageType]=>.jpg [contentImagePath]=>/var/www/bangmarketing.bang/media/uploads/contentImages/5/housingplus.jpg [isHeadlineImage]=>1 [ContentImageDateUpload]=>1265284989 [contentId]=>5 [dashboardUserId]=>0 [contentTitle]=>Bang发布Housing Plus [contentAbstract]=>Bang推出了Housing Plus,这是中央边界住房集团的新品牌,以及新的子品牌Property Care和SSHA

[contentBody]=>这家总部位于米德兰的集团,营业额超过2100万英镑,2008年在40多家机构的公开推介后任命了Bang。Bang的工作始于一项广泛的营销研究战略,该战略挑战了该集团以前的定位和品牌结构

这项研究揭示了房地产行业需要一个以价值观为导向的群体。这使得Bang为了正确的理由共同开发了勇敢的“房屋+”定位

Bang的营销总监Chris Garratt解释说:“近年来,房地产行业发生了大规模的变化,这与t
$titles = array();
foreach ($query->result_array() as $row) {
    $title = $row['categoryTitle'];
    if (!in_array($title, $titles)) {
        $titles[]['title'] = $title;
    }
}

for ($i = 0; $i < count($titles); $i++) {
    $title = $titles[$i]['title'];
    $this->db->select('*');
    $this->db->from('contentImagesTable');
    $this->db->join('contentTable', 'contentTable.contentId = contentImagesTable.contentId');
    $this->db->join('categoryTable', 'categoryTable.categoryId = contentTable.categoryId');
    $this->db->where('categoryTitle', $title);
    $query = $this->db->get();
    foreach ($query->result_array() as $row) {
        $titles[$i]['images'][] = $row['contentImagePath'];
    }
}