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
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!

 

 

Link to comment
Share on other sites

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.