the plugin « psnGeneric version 1.0.1 is finally out ! It was announced few weeks ago…But I had a lot of work to do that’s why it is out only today !

So what’s the plugin ?

Do you see the « quote » block on the left side of this site ? and the « download » filelist block (also on the left side) ? Both are done via the psnGeneric version 1.0.1

So in other word, it is something that display an extract or a full list of records based on a criteria.

For the « quote » example, here is the line added in my « index.php » : the_genRandom( 'QUOTE',1,'','','', ''); .
For the « download » example, the following code is used : genList( 'WPHACK',100,'','','', '');

How to create/manage those lists ?

I create a small administration page for that.

Three different actions are possible : editdeletecreate.

Everything is done via a very easy and intuitive tabular interface.

[EDIT]
In order to fix a small mySQL syntax issue (for old mySQL versions), you have to update the line 94 of wp-admin/psnGENAdmin.php as below :

Change $psnSQLLimit = "LIMIT ".$psnLimit." OFFSET ".$psnOffset;
into $psnSQLLimit = "LIMIT ".$psnOffset.",".$psnLimit;

Thanks Bernd Pressler to notify me about this.

6 commentaires

  1. Hmmm – I installed your plugin as mentioned in the readme, but in the admin interface I get:
    Database error: [You have an error in your SQL syntax near ‘OFFSET 0’ at line 1]
    select * from psnGeneric where KeyField =  » LIMIT 30 OFFSET 0

  2. Already found the solution. My mySQL DB didn’t understand the syntax that’s used here. Solution: not use LIMIT $limit OFFSET $OFFSET, but rather use: LIMIT $OFFSET,$LIMIT

    had to change psnAdmin.php like this:

    $where = ''; $psnSQLLimit = "LIMIT ".$psnLimit." OFFSET ".$psnOffset;

    Changed to:

    $where = ''; /* $psnSQLLimit = "LIMIT ".$psnLimit." OFFSET ".$psnOffset;*/ $psnSQLLimit = "LIMIT ".$psnOffset.",".$psnLimit;

    Works fine now.

  3. 🙂 but
    The standard mySQL syntax is :

    SELECT
    [ALL | DISTINCT | DISTINCTROW ]
    [HIGH_PRIORITY]
    [STRAIGHT_JOIN]
    [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
    [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
    select_expr,…
    [INTO OUTFILE ‘file_name’ export_options
    | INTO DUMPFILE ‘file_name’]
    [FROM table_references
    [WHERE where_definition]
    [GROUP BY {col_name | expr | position}
    [ASC | DESC], … [WITH ROLLUP]]
    [HAVING where_definition]
    [ORDER BY {col_name | expr | position}
    [ASC | DESC] ,…]
    [LIMIT {[offset,] row_count | row_count OFFSET offset}]
    [PROCEDURE procedure_name(argument_list)]
    [FOR UPDATE | LOCK IN SHARE MODE]]

  4. For compatibility with PostgreSQL, MySQL also supports the LIMIT row_count OFFSET offset syntax. To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter.

    Taken from:
    http://dev.mysql.com/doc/mysql/en/SELECT.html

    The problem is, that I am still using an older mySQL version 3.2.23 IIRC.

  5. Totally agree ! 🙂 Well, most important thing is : it works !

Comments are closed, but trackbacks and pingbacks are open.