Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Database Error when publishing

Status Resolved
Add-on / Version Publisher
Severity Critical
EE Version 31

Johannes Lamers

Jun 10, 2013

After publishing an item i get this error:

A Database Error Occurred
Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 3

SELECT `page_url`, `url_title`, `publisher_lang_id`, `publisher_status`, `entry_id` FROM (`exp_publisher_titles`) WHERE `entry_id` IN ()

Filename: third_party/publisher/models/publisher_site_pages.php

Line Number: 201


PHP version: 5.3.8
MySQL version: 5.5.15

#1

BoldMinded (Brian)

If you don’t mind editing PHP, try this change:

line 197

if (is_array($entry_id) && !empty($entry_id))

#2

Johannes Lamers

Nope. No good. A new error appears:

A Database Error Occurred Error Number: 1054

Unknown column ‘Array’ in ‘where clause’

SELECT page_url, url_title, publisher_lang_id, publisher_status, entry_id FROM (exp_publisher_titles) WHERE entry_id = Array

Filename: third_party/publisher/models/publisher_site_pages.php

Line Number: 207

#3

BoldMinded (Brian)

What if you update the whole method to this?

private function get_url_titles($entry_id)
    {
        if (is_array($entry_id) && !empty($entry_id))
        {
            $qry = ee()->db->select('page_url, url_title, publisher_lang_id, publisher_status, entry_id')
                            ->where_in('entry_id', $entry_id)
                            ->get('publisher_titles');
        }
        else if($entry_id)
        {
            $qry = ee()->db->select('page_url, url_title, publisher_lang_id, publisher_status, entry_id')
                            ->where('entry_id', $entry_id)
                            ->get('publisher_titles');
        }
        else
        {
            return array();
        }
        

        $url_titles = array();

        foreach ($qry->result() as $row)
        {
            $url_titles[$row->publisher_status][$row->publisher_lang_id][$row->entry_id] = ($row->page_url != '') 
                ? $row->page_url 
                : $row->url_title;
        }

        return $url_titles;
    }
#4

Johannes Lamers

It works! Thanks a lot!!!!

Login to reply