Jump to content

Recommended Posts

I am joining two tables so I can replace the value in table2 with the value in table 1, (fieldname is pod), but I get this error:

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\mc\testbundle.php on line 15

 

$consultsq1 = "SELECT icu.mrn, icu.id_incr, bundle.pt_id, icu.pod as pod1, 
bundle.pod as pod2, bundle.vent_id  
FROM icu INNER JOIN bundle ON icu.id_incr = bundle.pt_id  "; 

$result = mysql_query ($consultsq1) or die ("Invalid query: " . mysql_error ());

while ($row = mysql_fetch_assoc ($results)) {

	$pod= $row['pod1'];
	$mrn=$row['mrn'];
	$vent_id=$row['vent_id'];
	echo "pod mrn vent it is".$pod.",".$mrn.",".$vent_id."<br>";
	$sql = "UPDATE bundle SET mrn = '$mrn', pod='$pod'  WHERE vent_id = '$vent_id'";
if (isset($sql) && !empty($sql)) {	
$result = mysql_query($sql) or die ("Invalid querrry: " . mysql_error());	}


}

 

WHat I really want to do is search for all reords in bundle where the value of pod is blank, and then replace that blank value with the value of pod from the ICU table. Sorry if this is confusing.  But I can;t even get the above simple code to even work...

Thanks I removed the s. Now the first record is echoed and then the error comes up:

 

pod mrn vent it is1,555,323

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\mc\testbundle.php on line 15

Remove $result = in this code block

if (isset($sql) && !empty($sql)) {   
$result = mysql_query($sql) or die ("Invalid querrry: " . mysql_error());   }$result = mysql_query($sql) or die ("Invalid querrry: " . mysql_error());

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.