Jump to content

mysql_fetch_array only displaying first record


billborric

Recommended Posts

Hi,

 

I am having problems with the following code only adding the very first record and no others...

 

mysql_data_seek($result1, 0);
while ($stkrecord = mysql_fetch_array($result1, MYSQL_ASSOC)) {
	$stkrecord["id"] = "";
	$stkrecord["invno"] = $newinvno;
	// insert cloned copy of the original  record
	$s1 = "`".implode(array_keys($stkrecord), '`,`')."`";
	$s2 = "'".implode(array_values($stkrecord), "','")."'";
	$sql2 = "INSERT INTO `arinvtra` ($s1) VALUES ($s2)";
	//echo($sql);
	mysql_query($sql2);
}

 

...for some reason the 'while' is returning FALSE after the first record, exiting the loop and continuing with code following it.

 

I can mix and match the records, to see if there is one particular record causing the problem, but each record when used as the first will all be saved.

 

After a couple of hours on this, some help would be really appreciated.

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.