jvansanten

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • in reply to: Pass Parameters to filter SQL Query #123846
    jvansanten
    Participant

    Thank you very much for your close review.

    It was the setColModel that I’d commented out in the process of trying out variations. With that now active, the grid responds as it should. All the rest of the code is fine, and now I can fine tune that.

    Jay

    in reply to: Pass Parameters to filter SQL Query #123842
    jvansanten
    Participant

    I think I’m very close to a solution — as you note, the code appears correct.

    But, it’s not working. I really need to resolve this. I’ve studied the various documents and put together what seems to be the correct approach. But, I’m at a loss as to what approaches will lead to a solution.

    TIA for your assistance.

    in reply to: Pass Parameters to filter SQL Query #123839
    jvansanten
    Participant

    RE: Method 1.
    I recognize there are potential issues with using $_REQUEST. Hence, the name of the variable.

    IN RE: whether the parameter is passed, that should handled correctly by the following code, shouldn’t it be?

    $jvs_user_id = $_REQUEST[‘jvs_user_id’] ;
    $param1 = (isset($jvs_user_id)) ? $jvs_user_id : $USER->id ;
    ..
    $grid->setUrl(‘grid_center.php?jvs_user_id=’.$param1);

    On the first execution, the $_REQUEST should not have the jvs_user_id value, but the $USER->id, set by the Moodle environment, should be set. This is then assigned to $param1 and passed to the $_GET variable.

    On the 2nd execution at invocation, as a result, the $_REQUEST will have the variable value set and will be used to set the $param1 variable

    $grid->SelectCommand = ‘SELECT id, ‘ .
    ..
    ‘FROM mdl_centerstatus ‘ .
    “WHERE user_id = ” . $param1 ;

    When I generate my own log file and store the resulting SQL statement to it, on the second call, it is properly structured with the WHERE clause. And, when I bring that into phpMyAdmin, the query returns the correct row.

    However, this is what I get in the jqGrid.log file:

    Executed 1 query(s) – 2015-05-18 13:30:40
    Array
    (
    [0] => Array
    (
    [time] => 2015-05-18 13:30:40
    [query] => SELECT id, user_id, cohort_id, cohort_name, date_course_complete, gospel_pres_prv_yr, gospel_pres_m_1, gospel_pres_m_2, gospel_pres_m_3, gospel_pres_m_4, gospel_pres_m_5, gospel_pres_m_6, gospel_pres_tot_m_6, preg_test_prv_yr, preg_test_m_1, preg_test_m_2, preg_test_m_3, preg_test_m_4, preg_test_m_5, preg_test_m_6, preg_test_tot_m_6, commit_prv_yr, commit_m_1, commit_m_2, commit_m_3, commit_m_4, commit_m_5, commit_m_6, commit_tot_m_6, complete_date_m_6, grant_date FROM mdl_centerstatus WHERE user_id = ? ORDER BY cohort_name asc LIMIT 0, 10
    [data] => Array
    (
    [0] =>
    )

    [types] =>
    [fields] =>
    [primary] =>
    [input] =>
    )

    )

    It appears to me that the SQL statement is executed only once.

    Why is that?

    in reply to: Pass Parameters to filter SQL Query #123835
    jvansanten
    Participant

    Here’s the $_SESSION method.

Viewing 4 replies - 1 through 4 (of 4 total)

Stay connected with us in your favorite flavor!