daveoffy Posted November 9, 2008 Share Posted November 9, 2008 I have started making a website and ran into some PHP problems. I have: mysql_query("UPDATE members SET price = '0' WHERE member_id = '1'"); I need to change the member id from 1 to the member id to whoever is logged in. Can anyone help me? Quote Link to comment Share on other sites More sharing options...
peranha Posted November 9, 2008 Share Posted November 9, 2008 Store their member id in a variable and use that in the sql query. UPDATE members SET price = '0' WHERE member_id = '$membid' Quote Link to comment Share on other sites More sharing options...
daveoffy Posted November 9, 2008 Author Share Posted November 9, 2008 How will I set it in a variable. I made it $SESSION['SESS_MEMBER_ID'] will i do $membid = $SESSION['SESS_MEMBER_ID']; ? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 9, 2008 Share Posted November 9, 2008 Yes, or: mysql_query("UPDATE members SET price = '0' WHERE member_id = '{$_SESSION['SESS_MEMBER_ID']}'"); Quote Link to comment Share on other sites More sharing options...
daveoffy Posted November 9, 2008 Author Share Posted November 9, 2008 Yes, or: mysql_query("UPDATE members SET price = '0' WHERE member_id = '{$_SESSION['SESS_MEMBER_ID']}'"); Thank you so much. This worked great!!! 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.