Jump to content

Recommended Posts

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);

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

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);   

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.