Re: Embedding foreach loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allen, you off and running again?

Sure am, thanks, on to the next set of issues. Seems like programming is always moving on from one error to the next :)

Currently, I am having trouble with echo and php line-returns.

It works on one part of the code, but not on another (instead, prints it to html).

For example:

[code]

$show[show_01][price] * $show_01_qty = $Total_show_01;
 echo "\n<tr>\n\t";
echo "<td>a".$show[show_01][price]."</td>/n/t<td>*</td>/n/t<td>b". $show_01_qty."</td>/n/t<td>=</td>\n\t<td>c".$Total_show_01."</td>";
 echo "\n</tr>";

[/code]

outputs this html

[code]

<tr>
   <td>a</td>/n/t<td>*</td>/n/t<td>b</td>/n/t<td>=</td>
   <td>c</td>
</tr>

[/code]
Additionally, it won't display the variables, as you can see, even though they will echo out further above in the document. Odd...


well you escape a newline char with this slash:
\
and not this one:
/
notice you were not consistent with your use of them.
as for the array not being parsed inside your echo statement - I don't see the issue by looking now. Are you saying the EXACT same code does output the expected value for those array elements higher up the script? Show us the code where it is working and again where it is not.. side by side (pasted just after each other in a new post to the list).

I assume you are past this next point, but always remember
var_dump($myArray);
is your friend. Put it just before where you try to echo out some part of the array.. check to be sure the value is there is that element of the multi-dimensional array the way you think it is.

-John

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux