1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    1
    Vote Rating
    0
    cladawan is on a distinguished road

      0  

    Default How to get the result from multiple variables with multiple values.

    How to get the result from multiple variables with multiple values.


    Hi, I have a table student_subject which stores the subject of the student from the student_info table. My problem is since the student have multiple subjects, how I can get those other subjects? Should I use the $fetchRecords['x'] instead of $arg like this :

    echo '{"rootRecords":'.@json_encode($fetchRecords['x'].........).'}';

    below is my function

    function getRecords(){
    $readRecords= mysql_query("select student_info.student_id, student_name, student_lastname,subject_name FROM student_info, student_subject WHERE student_info.id = student_subject.student_id GROUP by student_info.student_id");

    while ($fetchRecords = mysql_fetch_assoc($readRecords)){

    $arg[] = array( 'sid' => $fetchRecords['student_id'] , 'lname' => $fetchRecords['student_lastname'] ,'fname' => $fetchRecords['student_name'], 'subjects' => $fetchRecords['subject_name']);
    }
    echo '{"rootRecords":'.@json_encode($arg).'}';
    }




    Ext.define('Data', {

    extend: 'Ext.data.Model',
    fields: [

    {name: 'what will I use in this fields?'},

    ]
    });



    Thank you very much in advance and more power.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You have sid, lname, fname and subjects fields.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
    Riley103 is on a distinguished road

      0  

    Default


    Quote Originally Posted by cladawan View Post
    Hi, I have a table student_subject which stores the subject of the student from the student_info table. My problem is since the student have multiple subjects, how I can get those other subjects? Should I use the $fetchRecords['x'] instead of $arg like this :

    echo '{"rootRecords":'.@json_encode($fetchRecords['x'].........).'}';

    below is my function

    function getRecords(){
    $readRecords= mysql_query("select student_info.student_id, student_name, student_lastname,subject_name FROM student_info, student_subject WHERE student_info.id = student_subject.student_id GROUP by student_info.student_id");

    while ($fetchRecords = mysql_fetch_assoc($readRecords)){

    $arg[] = array( 'sid' => $fetchRecords['student_id'] , 'lname' => $fetchRecords['student_lastname'] ,'fname' => $fetchRecords['student_name'], 'subjects' => $fetchRecords['subject_name']);
    }
    echo '{"rootRecords":'.@json_encode($arg).'}';
    }




    Ext.define('Data', {

    extend: 'Ext.data.Model',
    fields: [

    {name: 'what will I use in this fields?'},

    ]
    });



    Thank you very much in advance and more power.
    Thanks you for the post.
    __________________
    Watch Wrath of the Titans Online Free

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi