jnerotrix Posted December 6, 2008 Share Posted December 6, 2008 Ok my last topic was to big 6 pages it got confusing I am making a survey site that after you click on a survey its supposed to be hidden to the user who clicked it I currently get this error and i dont know how to fix it Unknown column '8190ef16bc01b56546027a349806ad2a' in 'where clause' 8190ef16bc01b56546027a349806ad2a is the member id... it has a hash 8190ef16bc01b56546027a349806ad2a = 0 What my thing does is saves member_id and survey_id to table completed_surveys and its supposed to check if the user has already seen this survey and if they have then it doesnt show it so heres the code i have for it not sure whats wrong <?php mysql_connect("localhost", "sex1800_admin", "***") or die(mysql_error()); //add you password mysql_select_db("sex1800_loginbux") or die(mysql_error()); $query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id WHERE member_id={$_SESSION['userid']}"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/ Share on other sites More sharing options...
corbin Posted December 6, 2008 Share Posted December 6, 2008 {$_SESSION['userid']} Is a string value, isn't it? Soooooo... It needs to be in quotes ;p. '{$_SESSION['userid']}' Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708011 Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 well that fiexed the error but now it displays nothing Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708053 Share on other sites More sharing options...
MadTechie Posted December 6, 2008 Share Posted December 6, 2008 is the field also hashed ? if not try $query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id WHERE md5(member_id)={$_SESSION['userid']}"; Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708067 Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 Still shows Nothing heres the site you have to register though to see the code im trying to fix http://epicbux.com/ Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708068 Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 <?php mysql_connect("localhost", "sex1800_admin", "***") or die(mysql_error()); //add you password mysql_select_db("sex1800_loginbux") or die(mysql_error()); $query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id WHERE member_id='{$_SESSION['userid']}'"; $result = mysql_query($query) or die(mysql_error()); echo mysql_num_rows($result); die(); while($row = mysql_fetch_array($result)){ echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708127 Share on other sites More sharing options...
jnerotrix Posted December 7, 2008 Author Share Posted December 7, 2008 ok now it just displays 0 Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708216 Share on other sites More sharing options...
dropfaith Posted December 7, 2008 Share Posted December 7, 2008 try to echo out the session userid it sounds like its not being set properly to me Quote Link to comment https://forums.phpfreaks.com/topic/135829-unknown-column-8190ef16bc01b56546027a349806ad2a-in-where-clause/#findComment-708272 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.