Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP table Data row
I want to update marks of a particular student in particular subject out of eight subjects. please inspect the following code.
echo 'Marks Details of  '.$id.'   in  '.$semester.'  semester'.'<br>';
$query='SELECT subname,marks
FROM `2-1subjects`
JOIN `2-1`
ON `2-1subjects`.subcode=`2-1`.subcode
WHERE id='."'".$id."'";
    
$sql=mysql_query($query);
if(!$sql)
{
  die('invalid Query:'.mysql_error());
}
Print "<table border=0 cellpadding=10>";
Print "<th>SUBJECT NAME</th>";
Print "<th>MARKS</th>";
while($row = mysql_fetch_array($sql))
{
 Print "<tr>";
 print "<td>".$row['subname'] . "</td> ";
    
                                      ?>
and the below two are my 2-1 and 2-1subjects tables respectively. here 'id' and 'subcode' are primary keys.
    
           id       subcode     marks
            10kp1a1201  2-1sub#5    80
            10kp1a1201  2-1sub#4    70
            10kp1a1201  2-1sub#3    60
            10kp1a1201  2-1sub#2    50
            10kp1a1201  2-1sub#1    40
            10kp1a1201  2-1sub#6    90
            10kp1a1201  2-1sub#7    100
            10kp1a1201  2-1sub#8    80
    
         subcode   subname credits
           2-1sub#1     s1  4
            2-1sub#2    s2  2
            2-1sub#3    s3  2
            2-1sub#4    s4  4
            2-1sub#5    s5  2
            2-1sub#6    s6  4
            2-1sub#7    s7  2
            2-1sub#8    s8  2
my question is since i have retrieved 'subname' and respective 'marks' in a table as shown in the above code using the same textbox in a while loop. Now i want to update 2 or 3 subjects according to the context. then how the modified marks along with subject name opposite to it in a table row are passed to another page.

How can i get the subjectname and value of the marks in the textbox from the retrieved table row , such that the updation tesk is depends on this (subname, marks) pair.

please help me. any answer is appreciable. Help me.
Posted 21-Jan-13 4:37am
Edited 21-Jan-13 5:35am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Bump the arrays into session variables, call the second page - retrieve the arrays from the session then zap 'em...
 
Danny
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 614
1 OriginalGriff 410
2 CPallini 230
3 RyanDev 161
4 Hard_Rockz 125
0 OriginalGriff 5,784
1 Sergey Alexandrovich Kryukov 4,838
2 Peter Leow 3,009
3 Maciej Los 2,894
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100