Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.