harikr Posted October 1, 2008 Share Posted October 1, 2008 hi, I am sending this string "ratings&reviews-projects" and trying the query for this string.I have encoded this string using encodeURIComponent() in javascript and it is sending the string perfectly to my php script. But i dont know why my query is not displaying anything evnthough the query has results. Here is my code, <?php $prod=$_REQUEST['listPrdMenu']; $result=mysql_query("SELECT name from components WHERE product_id=(SELECT id from products WHERE name='$prod')"); ?> <select name="compDetails[]" id="compDetails" size=7 class="style7" multiple > <option value="">- Select -</option> <?php while ($row = mysql_fetch_row($result)) { echo "<option>{$row[0]}</option>\n"; } ?> </select> Link to comment https://forums.phpfreaks.com/topic/126582-problem-in-getting-query-result/ Share on other sites More sharing options...
getmukesh Posted October 1, 2008 Share Posted October 1, 2008 Let us try this query, i have replaced "in" instead of "=" SELECT name from components WHERE product_id in (SELECT id from products WHERE name='$prod') Try this, i think it will solved the problem. Link to comment https://forums.phpfreaks.com/topic/126582-problem-in-getting-query-result/#findComment-654568 Share on other sites More sharing options...
harikr Posted October 1, 2008 Author Share Posted October 1, 2008 Sorry man my problem is it is not producing results for that string alone eventhough there are results. For other strings it is working fine Link to comment https://forums.phpfreaks.com/topic/126582-problem-in-getting-query-result/#findComment-654575 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.