paulchain Posted February 26, 2010 Share Posted February 26, 2010 OK here is what I'm trying to do I have 2 tables. I need to have it where someone enters some information in on a website and it saves the name and amount as variables. Then I need it to look at table 1 and search for that specific person's name that should be in the form of a variable due to the person previously entering it then on the same row copy their numerical id number into a variable. Then go to table 2 and search for that person's numerical number by using the previous variable, locate it and add the amount that the person entered on the website to a column that we will call Amount. Is this even possible if so how do I do this I cant find any information maybe due to me not knowing how to form the question. P.S. If you could please include examples to how to do this or something like it. Thanks a ton, Paul Quote Link to comment https://forums.phpfreaks.com/topic/193496-i-need-help-bad/ Share on other sites More sharing options...
paulchain Posted February 26, 2010 Author Share Posted February 26, 2010 This is what I have so far I am extremly new to MySql and php so I know im doing something wrong lol <?php include 'config.php'; include 'opengamedb.php'; $name = "SELECT name,id FROM players WHERE name='$_POST[charactername]'"; $name1 = mysql_query($name); $name2 = "SELECT itemId,itemCount,itemOwner FROM inventory WHERE itemOwner='$name1'"; mysql_query("INSERT INTO inventory (itemCount) VALUES ('_POST[kinah]'"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/193496-i-need-help-bad/#findComment-1018702 Share on other sites More sharing options...
fenway Posted February 27, 2010 Share Posted February 27, 2010 First, you get a resultset back from mysql_query() -- that's a hash, not a scalar. Second, why not use a join? Quote Link to comment https://forums.phpfreaks.com/topic/193496-i-need-help-bad/#findComment-1019141 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.