Click here to Skip to main content
12,701,314 members (34,637 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: (untagged)
$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 17:19pm

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2017
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