Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.