ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Query is not wokring on Templates

December 20, 2012 12:38am

Subscribe [1]
  • #1 / Dec 20, 2012 12:38am

    bhumika

    8 posts

    Hello, I want to user the DB function on admin template .can any one know the how to access it , below is my code

    $this->EE->db->where(‘member_id’, (int) $member_id);
    $this->EE->db->update(‘members’, $hashed_pair);

    I want to access the above function on admin template , but above query is not working .

    Please suggest me , how to work ?

    Thanks

  • #2 / Dec 20, 2012 2:06am

    Bhashkar Yadav

    727 posts

    Are you getting any error message here?

    It would be good if you could share more code which you are using to update the member’s record.


    Best Regards,

  • #3 / Dec 20, 2012 2:28am

    bhumika

    8 posts

    Hello, I have to update the memer information usign external link ,  below is my example

    I am passing below url via mail for login user .

    http://localhost/testing_ee/user/user-login/user_id

    user : Main Template Group [Template Groups ]
    user-login : inside the mail template
    user_id : pass dynamic value

    below is the member_id = 20 , and i will pass on url.

    http://localhost/testing_ee/user/user-login/20

    I have created the user-login template like attachment

    Now I have fetch the Id and update the information on db

    I have set below configuration on templates prefrences
    Allo Php ? : yes
    Php Pharsing Stage :  Input

    After submitting code i am using php code on same template and use the below code for update

    $this->EE->db->where(‘member_id’, (int) $member_id);
    $this->EE->db->update(‘members’, $hashed_pair);

    there is not error is generated , and Record is not updated .

    Please suggest me

  • #4 / Dec 20, 2012 3:27am

    Bhashkar Yadav

    727 posts

    What about the $hashed_pair? It should be array containing table column name as index and it’s value.

    Try by using simple MySQL query:

    $this->EE =& get_instance();
    $this->EE->db->query("UPDATE exp_members SET ........");

    Do one more thing. Go to Control Panel -> Admin -> System Administration -> Output and Debugging Preferences.

    Here set “Debug Preference” as “2: PHP/SQL error messages shown to anyone” so that you can see error message if any.

     

    Best Regards,

  • #5 / Dec 20, 2012 3:29am

    bhumika

    8 posts

    Ok sure, Let me try this way and inform you .

    Thank you so much

  • #6 / Dec 20, 2012 3:37am

    bhumika

    8 posts

    I got the below error ,

    Fatal error: Using $this when not in object context in D:\wamp\www\testing_ee\system\expressionengine\libraries\Functions.php(660) : eval()‘d code on line 90

    Please suggest me

    Thanks

  • #7 / Dec 20, 2012 4:00am

    Bhashkar Yadav

    727 posts

    $ee =& get_instance();
    $ee->db->query("UPDATE exp_members SET ........");
  • #8 / Dec 20, 2012 4:35am

    bhumika

    8 posts

    Still not working ..
    below error is occured

    Error Number: 1064

    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 ‘BQL@}Q.)H)/B8!QSym9\x}$;D)h6!F_{F54""*O.vv-zu' WHERE member_id='20'' at line 1

    UPDATE exp_members SET password='98d9234fbfa493b36b63ab9e91e70324ef4a3672d7bfbf1f56747111f39be6e9f800f232c61aa9ebd12acb16d10ecc65b3403ed885065ee670424417ad9b4094' , salt='i04A4eW[_v8N?UNJSE:$odpFv?8Z77M8+4{}Mq7<%ql,rpSdT=irld~7?A`$/9=\\\\<<)HR8*5e8]y%L`kEF’BQL@}Q.)H)/B8!QSym9\x}$;D)h6!F_{F54”“*O.vv-zu’ WHERE member_id=‘20’

    Filename: D:\wamp\www\testing_ee\system\codeigniter\system\database\DB_driver.php

    Line Number: 330

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases