How to use a specific Select - Serverside

How to use a specific Select - Serverside

DestinyDestiny Posts: 4Questions: 2Answers: 0
edited June 2014 in Free community support

Hello i try to do a specific "Select" but i don´t know how... . There is no hint on this website how to do it. I just found the words you have nothing to change if you want the standard things, at the serverside part. But i want to have my specific select... . Can somebody help me?

I use serverside + ajax pipelining

This is my serverside part at the moment:
http://pastebin.com/2tGirvqc

now i want to have a specific select like:
"SELECT * FROM ".$table." WHERE userid=16"

If you could say me how i can handle that part i would be very thankfully!

Answers

  • crayvoccrayvoc Posts: 3Questions: 1Answers: 0
    edited June 2014

    I'm pretty new to this so take my advice with a grain of salt.

    Take a look at ssp.class.php, make a copy of the simple() function and call it simpleTWO() (brilliant, I know) and do something like:

    $data = SSP::sql_exec( $db, $bindings,
    "SELECT SQL_CALC_FOUND_ROWS `".implode("`, `", SSP::pluck($columns, 'db'))."`
    FROM `$table`
    $where
    AND WHERE userid = 16
    $order
    $limit"
    );
    

    Now you just call SSP::simpleTWO( $_GET, $sql_details, $table, $primaryKey, $columns )

    Or put a switch into the simple() function and check for some keyword like

    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $hipleaseuseme )

    edit: No idea why there's no code block showing, sorry about that

  • DestinyDestiny Posts: 4Questions: 2Answers: 0

    sorry but i don´t understand that. Why do you want to copy the simple function without any changes.

    The other thing is
    "SELECT SQL_CALC_FOUND_ROWS <code>"
    you create a select and i would say SQL_CALC_FOUND_ROWS is the same as * . So you get all from the database in combination with the static pluck method.

    The <code> stuff, for what is it? You use it also at the from part:
    <code>$table</code>

    $where as well as $order and $limit is already set by default values and you need them?

    Also my main question how or where do you use your $data variable?
    I mean you have to write the static simple method before or after $data?
    I mean you don`t use $data as paramter in the static method, simple.

    If you could explain it a little bit more, it would be great.
    Thank you!

This discussion has been closed.