We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37619
    • 79 Posts
    I'm using Revo 2.2.1 and Rowboat 1.1.0

    Hello,

    When fetching data from a custom table in the database, the results show up as they should, but I also get the following text just before the results:

    PDOStatement Object ( [queryString] => SELECT * FROM `table_name` WHERE `part_number` = :part_number LIMIT 10 ) PDOStatement Object ( [queryString] => SELECT COUNT(*) `ct` FROM `table_name` WHERE `part_number` = :part_number )

    This is my Rowboat call:
    [[!Rowboat?
        &table=`[[!get_db_table]]`
        &tpl=`[[!get_product_type]]`
        &where=`{"part_number":"[[!get_product_id]]"}`
        &cacheResults=`0`
    ]]


    I've noticed that if I remove &cacheResults, those 2 lines will still show up, but if I refresh the page, then they'll disappear until I change a variable in the URL or until I change something in my tpl.

    Any help would be appreciated. Thank you.
      Jean-Marc Buytaert (@jmbuytaert)

      MODX truly is the greatest thing that's ever happened to the Internet.
      • 1331
      • 129 Posts
      Looks like your JSON where clause is messed up. I think it should be
      &where=`{"part_number:=":[[get_product_id]]}`
        • 37619
        • 79 Posts
        That didn't change anything. The results still show up fine, no matter what the part_number is in the URL. Thank you for looking into it though.
          Jean-Marc Buytaert (@jmbuytaert)

          MODX truly is the greatest thing that's ever happened to the Internet.
          • 3647
          • 177 Posts
          Hi Jean

          Not sure if I can help you, but what do you have in
          [[!get_db_table]]
            • 37619
            • 79 Posts
            Quote from: bluespark at Aug 20, 2013, 08:27 AM
            Hi Jean

            Not sure if I can help you, but what do you have in
            [[!get_db_table]]

            Hey Bluespark,

            [[!get_db_table]] just sets the DB table depending on what's in the URL. This is what my URL looks like: http://www.site.com?table=ab&prod=123 so all the [[!get_db_table]] snippet does is get take the table variable from the URL and sets the actual DB table name depending on the URL variable. I don't think the error comes from there because if you look at the message that shows up, the table name comes up fine.

            However, I want to say that the part_number is where there's an issue, maybe in the &where=`` JSON clause, as ambaxter mentions. In this case, the [[!get_product_id]] snippet does the same thing as [[!get_db_table]]: it pulls up the product number and spits it back out, but there might be something funky going on in my JSON.

            It's still showing up weird.
              Jean-Marc Buytaert (@jmbuytaert)

              MODX truly is the greatest thing that's ever happened to the Internet.
              • 37619
              • 79 Posts
              Similar problem on same site:

              Rowboat call:
              [[!Rowboat?
              	&table=`custom_table_name`
              	&tpl=`my_tpl`
              	&columns=`{"field1":"","field2":"","field3":"","field4":"","field5":"","field6":""}`
              	&limit=`0`
              	&where=`{"field7":"S", "field1:LIKE":"S%"}`
              	&sortBy=`field2, field3, field4`
              	&sortDir=`ASC`
              ]]


              This time, I'm not using any snippets in &table=`` or &where=``. The results show up fine, just as they should, but I also get the PDO statement:

              PDOStatement Object ( [queryString] => SELECT `field1`,`field2`,`field3`,`field4`,`field5`,`field6`
              FROM custom_table_name` WHERE `field7` = :field7 AND `field1` LIKE :field1 ORDER BY `field2` ASC, `field3` ASC, `field4` ASC )


              Does anyone know why it's showing up? Thanks.
                Jean-Marc Buytaert (@jmbuytaert)

                MODX truly is the greatest thing that's ever happened to the Internet.
                • 1331
                • 129 Posts
                Maybe it's triggering the debug feature of Rowboat? Try adding
                &debug=`0`