WordPress.org

Ready to get started?Download WordPress

Forums

Help with image hack (16 posts)

  1. Anonymous
    Unregistered
    Posted 10 years ago #

    I've posted this elsewhere twice but I have gotten no response, so I am trying one last time:
    I got a hack from http://www.lennartgroetzbach.de/phps/cpg.plugin.phps
    and I installed it, but now, everytime I post the code for the image all I get when I want to view it is this:
    SQL/DB Error:
    [You have an error in your SQL syntax near 'OFFSET 4' at line 1]
    SELECT filepath, filename, title FROM pix_pictures WHERE aid=5 ORDER BY 5 LIMIT 1 OFFSET 4
    the blog is here: http://www.riding-shotgun.de/blog/
    help would be very much apriciated.

  2. Anonymous
    Unregistered
    Posted 10 years ago #

    What version of WordPress are you using?

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    I'm using 1.0.2

  4. idahocline
    Member
    Posted 10 years ago #

    There are only 3 fields in the select but the query asks a sort on the fifth !
    So....in the plugin source, you should update or remove the "order by".:
    $wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY '.$aid.' LIMIT 1 OFFSET '.($pos - 1));

  5. idahocline
    Member
    Posted 10 years ago #

    $wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY 3 LIMIT 1 OFFSET '.($pos - 1));
    to sort on the title

  6. Anonymous
    Unregistered
    Posted 10 years ago #

    hey idahocline, I took a look at the code and what you posted there is what it already says in line 89... or where am I supposed to replace it?
    I also tried the psnGallery.php hack, but that gave me even worse errors... I really want to have something like this :-(

  7. Anonymous
    Unregistered
    Posted 10 years ago #

    Ok, I put this in line 89 $wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY 3 LIMIT 1 OFFSET '.($pos - 1));
    but I am still getting an error:
    SQL/DB Error:
    [You have an error in your SQL syntax near 'OFFSET 4' at line 1]
    SELECT filepath, filename, title FROM pix_pictures WHERE aid=5 ORDER BY 3 LIMIT 1 OFFSET 4

  8. idahocline
    Member
    Posted 10 years ago #

    Well, if you take the code from the link you wrote above, the code to update is indeed at line 98. But the code is :
    $wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY '.$aid.' LIMIT 1 OFFSET '.($pos - 1));
    and not
    $wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY 3 LIMIT 1 OFFSET '.($pos - 1));
    What problems have you encountered with "psnGallery" ?

  9. Anonymous
    Unregistered
    Posted 10 years ago #

    I'll reinstall the psngallery hack and show you, give me a sec.

  10. Anonymous
    Unregistered
    Posted 10 years ago #

    btw, the $wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY 3 LIMIT 1 OFFSET '.($pos - 1)); is still not working. but yeah, let me do the psngallery thing, you'll see.

  11. Anonymous
    Unregistered
    Posted 10 years ago #

    Ok, got it, pleas go here and have a look: http://www.riding-shotgun.de/blog/

  12. idahocline
    Member
    Posted 10 years ago #

    let's continue per mail....At first look, it seems that you haven't configured correctly the module....
    I am at work for the moment. But I have finished in 4 or 5 hours I will be at home. Send me a mail with your version of psnGallery.php. I will have a look. (admin at idahocline dot com)
    While executing query "SELECT * FROM dbname.cpg11d_config" on 0
    mySQL error: Access denied for user: 'v109938@localhost' to database 'dbname'
    dbname is the variable name the module.
    cpg11d is the default value....

  13. Anonymous
    Unregistered
    Posted 10 years ago #

    That'd be so nice, because I would rather have this hack, I liked the way it works better, but I am blind when it comes to code. I will send you the file.
    Thanks so much!

  14. idahocline
    Member
    Posted 10 years ago #

    at the end of the code, you should find :
    // MySQL configuration
    $CONFIG['dbserver'] = "localhost"; // Your database server
    $CONFIG['dbuser'] = "user"; // Your mysql username (v109938 I assume)
    $CONFIG['dbpass'] = "password"; // Your mysql password
    $CONFIG['dbname'] = "dbname"; // Your mysql database name
    $CONFIG['urlsite'] = "http://gallery.idahocline.com";
    // MySQL TABLE NAMES PREFIX
    $CONFIG['TABLE_PREFIX'] = $CONFIG['dbname'].".cpg11d_";
    So update those entries according yours.... Don't forget to change "cpg11d_" into "pix_" (I assume, according your error message

  15. Anonymous
    Unregistered
    Posted 10 years ago #

    ok, so now I have this:
    // MySQL TABLE NAMES PREFIX
    $CONFIG['pix_'] = $CONFIG['dbname']."pix_";

    but still get this:
    While executing query "SELECT * FROM dbname.cpg11d_config" on 0
    mySQL error: Access denied for user: 'v109938@localhost' to database 'dbname'
    I'm frustrated :-(

  16. idahocline
    Member
    Posted 10 years ago #

    the update you have to update the values not the "identificators"
    $CONFIG['dbserver'] = "localhost"; // Your database server
    $CONFIG['dbuser'] = "user"; // Your mysql username (v109938 I assume)
    $CONFIG['dbpass'] = "password"; // Your mysql password
    $CONFIG['dbname'] = "dbname"; // Your mysql database name
    $CONFIG['urlsite'] = "http://gallery.idahocline.com";
    // MySQL TABLE NAMES PREFIX
    $CONFIG['TABLE_PREFIX'] = $CONFIG['dbname']."cpg11d_";
    Sorry I should have been more precise....

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.