ryanteck Posted January 18, 2011 Share Posted January 18, 2011 Im trying to get a code to find an id by name and then find a value by id this kinda works can you help? <?php $con = mysql_connect("localhost","root","password"; if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ryanteck", $con); $result = mysql_query("SELECT * FROM forum_members WHERE member_name='ryan'"); while($row = mysql_fetch_array($result)) { echo $row['member_name'] . "s Id is " . $row['id_member']; echo "<br />"; $result2 = mysql_query("SELECT * FROM forum_themes WHERE id_member= $id && variable= 'cust_uberis'"); while($row = mysql_fetch_array($result2)) or die (mysql_error()); { echo $id . "Uber Island Is " . $row['value']; echo "<br />"; } } ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 18, 2011 Share Posted January 18, 2011 Can we help with what, exactly? Quote Link to comment Share on other sites More sharing options...
Rifts Posted January 18, 2011 Share Posted January 18, 2011 this $result2 = mysql_query("SELECT * FROM forum_themes WHERE id_member= $id && variable= 'cust_uberis'"); should be $result2 = mysql_query("SELECT * FROM forum_themes WHERE id_member= $id AND variable= 'cust_uberis'"); Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 18, 2011 Share Posted January 18, 2011 Changing && to AND won't matter at all. Quote Link to comment Share on other sites More sharing options...
Coolkat Posted January 18, 2011 Share Posted January 18, 2011 in your code you are using the variable $id in your query but you never defined it.. I assume you want to use $row['id_member']'s value in your second query so you will need to put after the query, $id = $row['id_member'] Quote Link to comment Share on other sites More sharing options...
ryanteck Posted January 18, 2011 Author Share Posted January 18, 2011 Sorry about not writing a full post, i had to go half way through. Me and my friend are making a linking system to link his php game with my smf forum. what i need it to do is first find the user id off the name ( first part ) which works. we then need it to use that id to find the value after searching for that id and variable. thanks ryan Quote Link to comment 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.