jason1987 Posted October 17, 2007 Share Posted October 17, 2007 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); Quote Link to comment https://forums.phpfreaks.com/topic/73623-solved-insert-update-from-select-help/ Share on other sites More sharing options...
Barand Posted October 17, 2007 Share Posted October 17, 2007 $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. Quote Link to comment https://forums.phpfreaks.com/topic/73623-solved-insert-update-from-select-help/#findComment-371445 Share on other sites More sharing options...
jason1987 Posted October 17, 2007 Author Share Posted October 17, 2007 thanks that has solved my problem Quote Link to comment https://forums.phpfreaks.com/topic/73623-solved-insert-update-from-select-help/#findComment-371460 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.