timmyd Posted May 17, 2008 Share Posted May 17, 2008 loop on mysql INSERT ends up in uploading only 1 row function link_id() { return $this->Link_ID; } function query_id() { return $this->Query_ID; } function query($Query_String) { $this->Query_ID = @mysql_query($Query_String,$this->Link_ID); } function connect($Database,$Host,$User,$Password) { if ( 0 == $this->Link_ID ) { $this->Link_ID=mysql_connect($Host, $User, $Password); if (!$this->Link_ID) { } if (!@mysql_select_db($Database,$this->Link_ID)) { $this->halt("cannot use database ".$this->Database); return 0; } } return $this->Link_ID; } $db=new db_connect; $x = "SELECT * FROM table1"; $db->query($x); while($db->next_record()){ $id =$db->f("id"); $y= "INSERT INTO table2 (id2) values('".$id."')"; $db->query($y); } whats stopping the loop? Link to comment https://forums.phpfreaks.com/topic/106015-loop-on-mysql-insert-ends-up-in-uploading-only-1-row/ Share on other sites More sharing options...
DarkWater Posted May 17, 2008 Share Posted May 17, 2008 Where is $db->next_record being added? Link to comment https://forums.phpfreaks.com/topic/106015-loop-on-mysql-insert-ends-up-in-uploading-only-1-row/#findComment-543344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.