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? Link to comment https://forums.phpfreaks.com/topic/132037-solved-new-site-php-help-please-help-deadline-is-coming-up/ 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' Link to comment https://forums.phpfreaks.com/topic/132037-solved-new-site-php-help-please-help-deadline-is-coming-up/#findComment-686125 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']; ? Link to comment https://forums.phpfreaks.com/topic/132037-solved-new-site-php-help-please-help-deadline-is-coming-up/#findComment-686132 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']}'"); Link to comment https://forums.phpfreaks.com/topic/132037-solved-new-site-php-help-please-help-deadline-is-coming-up/#findComment-686138 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!!! Link to comment https://forums.phpfreaks.com/topic/132037-solved-new-site-php-help-please-help-deadline-is-coming-up/#findComment-686149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.