Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    27
    Thanks
    1
    Thanked 0 Times in 0 Posts

    getting table column data in array problem

    Hello
    webmasters please help me
    i have 2 table 1 is
    student_information
    and
    exam_classtest_term
    in student_information table there has these coloumn
    id
    student_id
    firstname
    lastname
    nickname
    class roll_no
    session

    and in exam_classtest_term table there has these coloumn
    id
    student_id
    student_class
    student_roll
    sub_name
    session
    term
    obtain_marks

    i want to insert data to exam_classtest_marks for all student from student_information everytihing is fine but i could not get student_id data to insert exam_classtest_term
    how to get all student_id from student_information and make them serially to insert exam_classtest_term table against student_roll

    my php is code is
    PHP Code:
    <?php
    session_start
    ();
    include(
    "header.php");
    $class=$_SESSION['class']=$_POST['class'];
    $sess=$_SESSION['session'] = $_POST['session'];
    $sub=$_SESSION['subject'] = $_POST['subject'];
    $term=$_SESSION['term'] = $_POST['term'];
    include(
    "config.php");
    $query="SELECT * FROM student_information WHERE class='$class'";
    $result mysql_query($query);
    $num_rows mysql_num_rows($result);

        
    // initialization
        
    $photo_upload_fields "";
        
    $counter 1;

        
    // default number of fields
        
    $number_of_fields $num_rows

    // If you want more fields, then the call to this page should be like, 
    // preupload.php?number_of_fields=20

        
    if( $_GET['number_of_fields'] )
        
    $number_of_fields = (int)($_GET['number_of_fields']);

        
    // Firstly Lets build the Category List

    // Lets build the Photo Uploading fields
        
    while( $counter <= $number_of_fields )
        {
    $photo_upload_fields .=<<<__HTML_END
    <tr>
        <td>
             roll 
    {$counter}:<br />
             <input type='hidden' name='roll[]' value='$counter'/>
        </td>
    </tr>
    <tr>
        <td>
             <input name='sid[]' type='hidden' [COLOR="Red"]value='value in not getting'/><br />problem here[/COLOR]
        </td>
    </tr>
    <tr>
        <td>
             marks:<input name='marks[]' type='text' />
        </td>
    </tr>
    <tr>
        <td>
             <input name='sub[]' type='hidden' value='$sub'/>
        </td>
    </tr>
    <tr>
        <td>
             <input name='sess[]' type='hidden' value='$sess'/>
        </td>
    </tr>
    <tr>
        <td>
             <input name='class[]' type='hidden' value='$class'/>
        </td>
    </tr>
    <tr>
        <td>
            <input name='term[]' type='hidden' value='$term'/>
        </td>
    </tr>
    __HTML_END;
        
    $counter++;
        }

    // Final Output
    echo <<<__HTML_END
    <html>
    <body>
    <form  action='marksentry1.php' method='post'>
    <table width='90%' border='0' align='center' style='width: 90%;'>
    <tr>
        <td>
            <p>&nbsp;</p>
        </td>
    </tr>

    <!-Insert the photo fields here -->
    $photo_upload_fields

    <tr>
        <td>
                <input type='submit' name='submit' value='Add marks' />
        </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    __HTML_END;
    ?>
    please help me anybody

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,038
    Thanks
    23
    Thanked 589 Times in 588 Posts
    I don't understand what you want, but I do know that your query won't work:
    Code:
    $query="SELECT * FROM student_information WHERE class='$class'";
    because you have no column named 'class' in the 'student_information' table.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •