Hello,
What I am trying to do is give a user the option to respond to his or her reviews. I am trying to populate a list menu with any song that they have reviews for but that ehy have not responed to. In the review table I have a column for response so I am trying to first check to see how many songs they have in the song table, then populate the list with any of those songs that have a null value in the response fiels for that songid. Heres the code for that section:
<select name="revresp" id="revresp" class="listmenus">
<option value="0" selected>Respond to your song reviews.</option>
<?php
$vquery = "SELECT songid, stitle FROM songs WHERE bandid= '$userid'";
$vresult = mysql_query($vquery, $conn);
if(mysql_num_rows($vresult)) {
$i=1;
while ($row = mysql_fetch_array ($vresult)) {
$stitle = $row['stitle'];
$songid2 = $row['songid'];
$vquery2 = "SELECT (*) FROM reviews WHERE songid='$songid2' AND response = ''";
$vresult2 = mysql_query($vquery2, $conn);
if(mysql_num_rows($vresult2)) {
echo "<option value=\"$songid2\">$i. $stitle</option>";
$i++;
}
}
}
?>
</select>
For some reason its not catching the NULL value for the response field. I have verified that in mysql the response column for that songid is NULL. If I take out
AND response = ''
it works fine. What the heck am I doing wrong and is this even a good method to use to begin with?
Thanks for any advice.