phpjay Posted July 16, 2011 Share Posted July 16, 2011 why my remarks get all remarks from my table i want only display the data only selected ID heres my code $result = mysql_query("SELECT `Remarks` FROM `$table2` WHERE ID = `$ID`"); while($row = mysql_fetch_array($result)) { $remarks = "$row[Remarks]"; $explodeTilde = explode('_', $remarks); foreach($explodeTilde as $k => $v) { $explodePipe = explode('|', $v); foreach($explodePipe as $k2 => $v2) { $date_entered = date("m/d/Y", strtotime($v2)); echo "<br>"; echo $v2 . ''; } } } Quote Link to comment https://forums.phpfreaks.com/topic/242109-problem-in-my-output/ Share on other sites More sharing options...
spiderwell Posted July 16, 2011 Share Posted July 16, 2011 in the WHERE part of the clause you have back ticks on the value of ID, remove those, I assume it is an integer value? WHERE ID = $ID"); Quote Link to comment https://forums.phpfreaks.com/topic/242109-problem-in-my-output/#findComment-1243373 Share on other sites More sharing options...
phpjay Posted July 16, 2011 Author Share Posted July 16, 2011 i remove the where clause ID same problem again Quote Link to comment https://forums.phpfreaks.com/topic/242109-problem-in-my-output/#findComment-1243377 Share on other sites More sharing options...
TeNDoLLA Posted July 16, 2011 Share Posted July 16, 2011 Don't see anything wrong in your code. Maybe you got multiple rows there with the same ID? Do you have any SQL command line program to test out the query? I have noticed it's a good practise to debug queries outside PHP in a program such as HeidiSQL or SQLYog or similar. Echo your query out before running it in PHP and copy&åaste this query to SQL command line and see results and try to figure why they are wrong. Can't help much more without knowing your data in db. Quote Link to comment https://forums.phpfreaks.com/topic/242109-problem-in-my-output/#findComment-1243400 Share on other sites More sharing options...
phpjay Posted July 16, 2011 Author Share Posted July 16, 2011 i used this one instead of array $row=mysql_fetch_assoc($result); Quote Link to comment https://forums.phpfreaks.com/topic/242109-problem-in-my-output/#findComment-1243409 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.