Jump to content

PHP implode is not working :(


Monkuar

Recommended Posts

$DB->query("SELECT tid FROM reports WHERE id IN ($ids)");
  while ($max = $DB->fetch_row()){

  echo $max['tid'];
}

 

This code spits out:

 

12012167

 

It's grabbing 120, and 121 and 67.  Those are my "tid" for each column in my database "reports"

 

The problem I am trying to make it echo 120,121,67

 

So I use the explode:

 

$tids = explode(",", $max['tid']);
echo $tids;

 

Then it echo's out.

 

ArrayArrayArray

 

Any idea guys?

 

Link to comment
https://forums.phpfreaks.com/topic/253138-php-implode-is-not-working/
Share on other sites

foggy idea/hint...

what happens if you change this

echo $max['tid'];

 

to this

echo $max['tid'] . "<br>";

 

 

 $DB->query("SELECT tid FROM reports WHERE id IN ($ids)");
$arr = array();
while ($max = $DB->fetch_row()){
$arr[] = $max['tid'];
}
echo implode(',', $arr);

 

Topic Resolved!

 

 

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.