Jump to content

help me with an array issssuuue ..


imarockstar

Recommended Posts

I am trying to print out an array ... here is my code

 

$a = array($rows['gq_options']);

foreach ($a as $v) {
   echo " $v<Br>";
}

 

 

this is the output i am getting :

 

Dr,Mr,Mrs,Miss,Ms

 

what i need is there to be a beak after each value ... what am i missing here ...

 

the array i have is coming from comma separated row in a database ..

this is how i have it in the database

 

Dr,Mr,Mrs,Miss,Ms

 

do i hvae it in the DB wrong ?

 

 

Link to comment
https://forums.phpfreaks.com/topic/163558-help-me-with-an-array-issssuuue/
Share on other sites

new code

 

$a = array($rows['gq_options']);

foreach ($rows['gq_options'] as $v) {
   echo " $v<Br>";
}

 

and the error, lol :

 

 

Warning: Invalid argument supplied for foreach() in /home/franklin/public_html/sites/questions/questions_general.php on line 25

 

line 25 is the foreach line ....

 

 

 

 

Hmm, without seeing the entire code its hard to decipher exactly what you are doing here..  try this and let me know the output..

 

$a = array($rows['gq_options']);

print_r($rows['gq_options']);
echo "<br><br>";

#foreach ($rows['gq_options'] as $v) {
#   echo " $v<Br>";
#}

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.