Back Home

Open Designs

Community. Driven.

  1.  
    WordPress database error: [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]
    SELECT * FROM `wp_designs` WHERE `approved`=1 && `user` =

    While searching for a design i found that sql query is showing on the top



    WordPress database error: [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]
    SELECT * FROM `wp_designs` WHERE `approved`=1 && `user` =
    Search Results
    « Back to search
    No results found
    • CommentAuthorMattKern
    • CommentTimeJun 13th 2008
     
    there are 2 ampersands (&) and there should be just one.
  2.  
    Actually, && is correct. It's the logical operator equivalent to AND. However, you can't end with "`user`=" you need something that you want it to be equal to.

    Lostwarrior: Can you duplicate it? What options did you select to make it happen?

    Admins: I no longer have a copy of the search script I wrote, but it seems that there might be a glitch now. If you send it to me at opendesigns@xavisys.com I'll try to find it, fix it, and send it back.
    • CommentAuthorMattKern
    • CommentTimeJun 13th 2008
     
    Interesting. I didn't know SQL used &&.
  3.  
    I managed to replicate it by searching for designs by a user that didn't exist, and have fixed the problem by making sure the designer name is valid before running the query.

    Aaron, I've emailed a copy of the new script (with old code in comments) for you to have a scan over if you want.
  4.  
    Thanks Christopher. I got it, and looked it over. There doesn't look to be anything wrong with the code, as long as it works. I remember that your database differs from the standard one, not to mention my memory isn't great so I don't remember exactly what the older WP database structure was like (major changes in 2.3 and again with 2.5...as I'm sure you know).

    MattKern: SQL standards use AND and OR but MySQL allows AND, &&, OR, and ||
    • CommentAuthorMattKern
    • CommentTimeJun 13th 2008
     
    Thanks aaron. After re-reading the post I realized the original topic was an OD error. My reply was off on so many levels.

    The hazards of scanning...
    • CommentAuthorDeanStev
    • CommentTimeJun 15th 2008
     
    The RSS Feed isn't showing?
    •  
      CommentAuthorSean
    • CommentTimeJun 15th 2008
     
    @DeanStev: Which RSS feed isn't showing?
  5.  
    The Design Feed had invalid characters in it so wasn't displaying correctly - I fixed it earlier.
    • CommentAuthorDeanStev
    • CommentTimeJun 15th 2008
     
    Thanks Christopher! that's the one :)
    I just clicked RSS Feed down the left hand side, and got a blank page before; now it's showing right... I'd never clicked it before, so thought I'd take a look :p
  6.  
    Yeah it because some of the templates in the feed used HTML characters in their descriptions (e.g. &) but weren't converted to their HTML entities, so wrapping the description in <![CDATA[ ... ]]> tags was the easy fix!