SQL error

This topic is: not resolved

This topic contains 6 replies, has 3 voices, and was last updated by  logikal16 3 years, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #158094

    logikal16
    Member

    @freezewood – Did you initialize the Pod class with the name of one of your pods? E.g.

    <pre><?php
    // Bad
    $Record = new Pod();

    // Good
    $Record = new Pod(‘event’);
    ?></pre>

    #158095

    sc0ttkclark
    Keymaster
    Post count: 781

    @freezewood – Could you send a copy of the source code to us or give us a link to where this is happening?

    #158096

    logikal16
    Member

    @cybertrack – Do you remember if you got an error when you first tried adding the "_REPEATED" column?

    #158097

    logikal16
    Member

    <pre><?php
    $author_pod = new Pod(‘author’);
    $author_pod->findRecords($orderby, $limit, $where);
    while ($author_pod->fetchRecord())
    {
    echo $author_pod->get_field(‘name’);
    }
    ?></pre>

    #158098

    laura
    Member

    That fixed that problem but I think I am going about this incorrectly. Following is my entire pod page. The problem I am having now is that there can be more than one author for each essay and if there is, I want them separated by commas but I can’t seem to get that to work. I can do this all in a helper using implode (I already got that to work) but I am really trying to understand this better by bypassing templates and helpers and putting all the code directly in the pod page. This is where I run into problems.

    As you can see, there are several pods being called on this page as I need detailed information from all of them.

    <pre>
    <?php
    $essay_pod;
    echo $essay_pod->showTemplate(‘essay_detail’);
    echo ‘<hr />’;

    </pre>

    #158093

    laura
    Member

    I am using a custom pod page and bypassing the template. Everything is working well for the most part but then I got stuck.

    Instead of using
    <pre>$pick_array = $this->get_field(‘name’); </pre>
    as I would in a regular pod page

    I am using
    <pre>
    $author_pod = new Pod(‘author’);
    $author_pod->findRecords($orderby, $limit, $where);
    $pick_array = $author_pod->get_field(‘name’);
    </pre>
    but I keep getting this error:
    <pre>
    Error: SQL failed; SQL: SELECT id FROM wp_pod WHERE datatype = ’14′ AND tbl_row_id IN (); Response: 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 1
    </pre>

    I am not sure why I am getting this error. Any ideas?

    #158099

    logikal16
    Member

    This is how to get a comma-separated list of essay authors.

    <pre><?php
    $author_list = array();

    foreach ($authorArray as $author) {
    $author_id = $author['id'];
    $author_list[] = $author['name'];

    }

    // Here’s your list of author names
    $author_list = implode(‘, ‘, $author_list);
    echo ‘Authors: ‘ . $author_list;
    ?></pre>

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Wordpress Cloud Hosting