Jump to content

problem in my output


phpjay

Recommended Posts

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 . '';


					}
				}



}
  

  

Link to comment
https://forums.phpfreaks.com/topic/242109-problem-in-my-output/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.