jnerotrix Posted December 8, 2008 Share Posted December 8, 2008 Its supposed to check if $memberid is in there and check if $memberid matches member_id and if they match do not display that survey id This is They Query i have so far but it doesnt do what i want it to do $query = "select survey.id, survey.title, survey.adlink from survey left join completed_surveys on ( survey.id = completed_surveys.survey_id ) WHERE completed_surveys.survey_id IS NULL AND completed_surveys.member_id=$memberid"; and heres the whole code <?php mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password mysql_select_db("sex1800_loginbux") or die(mysql_error()); $memberid = (is_numeric($_GET['id'])) ? $_GET['id'] : 0; $query = "select survey.id, survey.title, survey.adlink from survey left join completed_surveys on ( survey.id = completed_surveys.survey_id ) WHERE completed_surveys.survey_id IS NULL AND completed_surveys.member_id=$memberid"; $result = mysql_query($query) or die(mysql_error()); ?> Number Of Surveys Available = <?php echo mysql_num_rows($result); ?> <?php while($row = mysql_fetch_array($result)){ echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>"; } ?> Link to comment https://forums.phpfreaks.com/topic/136139-reading-mysql-table-correctly/ Share on other sites More sharing options...
shadiadiph Posted December 8, 2008 Share Posted December 8, 2008 here is one error i spotted straight away WHERE completed_surveys.survey_id IS NULL AND i think it should be WHERE completed_surveys.survey_id IS 'NULL' AND Link to comment https://forums.phpfreaks.com/topic/136139-reading-mysql-table-correctly/#findComment-710065 Share on other sites More sharing options...
gevans Posted December 9, 2008 Share Posted December 9, 2008 NULL doesn't need quotes it's like TRUE and FALSE Link to comment https://forums.phpfreaks.com/topic/136139-reading-mysql-table-correctly/#findComment-710073 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.