Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: insert Bug
                            $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 15-Jan-13 16:19pm

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 305
1 _Amy 235
2 Peter Leow 205
3 Andreas Gieriet 180
4 Dave Kreskowiak 130
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,412
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 15 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