Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
PHP
$insq='SELECT subcode FROM 2-1subjects';
    if(!$insq) { die('invalid Query:'.mysql_error()); }

           $insre=mysql_query($insq);
          //print_r ($insre);
           print_r ($mark).'<br>';
          while($subrow=mysql_fetch_array($insre))
          {
            print_r ($subrow).'<br>';
            $inser='INSERT into `2-1`(id,subcode,marks)
                   VALUES('."'".$id."'".','
                   ."'".$subrow['subcode']."'".','
                   ."'".$mr."'".')';
                  print $subrow['subcode'].'<br>';
             $inseresult=mysql_query($inser);
            if(!$inseresult)
              {
                die('invalid Query:'.mysql_error());
               }
             }


my problem is i want to retrieve a column from the table "2-1subjects", that contains a coumn such as

2-1sub#1 2-1sub#2 2-1sub#3 2-1sub#4 2-1sub#5 2-1sub#6 2-1sub#7 2-1sub#8

Now i want to insert the same column in same order into the table "2-1".

but it inserted in reverse order such as

2-1sub#8 2-1sub#7 2-1sub#6 2-1sub#5 2-1sub#4 2-1sub#3 2-1sub#2 2-1sub#1. I don't know the reason. please tell me and correct my code. Thanks in advance
Posted

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900