Jump to content

Recommended Posts

why isn't my insert and update working - i know the select statement returns the correct value as i have echoed it and used mysql to return its value

Its the ressimlink bit i think

 

$simlink = "SELECT simparentid FROM itsiminfo JOIN itequip ON itequip.equid = itsiminfo.simparentid WHERE itsiminfo.equid = '$equid' ";		 // for sim 
	//echo $simlink; 
	$ressimlink = mysql_query($simlink);
	$querytransins2 = " INSERT INTO itequiptransfers (equid, fromuserid, touserid) VALUES ('".$ressimlink."', '".$fromuserid."', '".$touserid."')";
  		$resulttransins2 = mysql_query($querytransins2);
    	$equins2 = "UPDATE itequip SET equuser='$touserid' WHERE equuser='$fromuserid' AND equid= '$ressimlink'";
    	$resultequins2 = mysql_query($equins2);

Link to comment
https://forums.phpfreaks.com/topic/73623-solved-insert-update-from-select-help/
Share on other sites

$ressimlink holds the resource id of the returned result set, not the simparentid.

 

<?php

$ressimlink = mysql_query($simlink);
$simparentid = mysql_result ($ressimlink, 0, 0);

 

Use $simparentid in the other queries.

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.