jason1987 Posted October 15, 2007 Share Posted October 15, 2007 hello, if anyone can help would be great On this project I have got 2 items a mobile and simcard, these are in one table as two records and have a unique equid each. the simcard is also in another table called siminfo and has a parentid (which is the same equid as the mobile) to create the link. In the equipment table there is also userid I already have code that transfers these items individually, but i want to be able to transfer them both when i transfer the sim card. I currently have the followin but its not working for some reason. the variable $equid does work i have tested it. This code is not picking up the simparentid though [$simlink = "SELECT simparentid FROM itsiminfo WHERE itequip.equid = '$equid'"; $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/73326-php-help-select-insert-update/ Share on other sites More sharing options...
marksie1988 Posted October 16, 2007 Share Posted October 16, 2007 wouldnt it be simpler for you to put the mobile phones and the simcard in the same table? seems daft having them seperate unless there is a reason this would probably make your problems easier to solve Quote Link to comment https://forums.phpfreaks.com/topic/73326-php-help-select-insert-update/#findComment-370511 Share on other sites More sharing options...
jason1987 Posted October 16, 2007 Author Share Posted October 16, 2007 I need to have them seperate because a user can have just a sim card or just a mobile I have changed it as follows but still not working :s $simlink = "SELECT simparentid FROM itsiminfo WHERE itequip.equid = '$equid' "; // for sim $ressimlink = mysql_fetch_assoc($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/73326-php-help-select-insert-update/#findComment-370527 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.