By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

in php the value keep - undefine help me pls!!

P: 93
hi people basically I am having a problem with the followinng code:
[PHP]
$names=sizeof($temp);
$report="total=$names&";

foreach($temp as $list)
$report.="name".$names--."=".$list."&";


echo $report;
[/PHP]

from the above code the "total" is always undefine when I try to output it even when I put "total =3" anybody know or there is something wrong with my code pls help thx~
Jul 19 '07 #1
Share this Question
Share on Google+
5 Replies


code green
Expert 100+
P: 1,726
[PHP]$names=sizeof($temp);
$report="total=$names&";
foreach($temp as $list)
$report.="name".$names--."=".$list."&";
echo $report;[/PHP]
from the above code the "total" is always undefine
I think in this instance php is treating total as a CONSTANT and not as a string..
You have to define a CONSTANT.
This code looks a real mess. What are youu trying to achieve?
Jul 19 '07 #2

P: 93
[PHP]$names=sizeof($temp);
$report="total=$names&";
foreach($temp as $list)
$report.="name".$names--."=".$list."&";
echo $report;[/PHP]

I think in this instance php is treating total as a CONSTANT and not as a string..
You have to define a CONSTANT.
This code looks a real mess. What are youu trying to achieve?
hi you mention I have to define a CONSTANT what do you mean ? basically I am trying to store the number of name inside the variable name total and pass it to the actionsript to output it
Jul 20 '07 #3

Atli
Expert 5K+
P: 5,058
So the output of the PHP code is being received by your Actionscript, which is unable to parse the "total=3" into a value?

There is nothing wrong with the PHP, this sounds like an actionscript problem.
Jul 20 '07 #4

P: 93
So the output of the PHP code is being received by your Actionscript, which is unable to parse the "total=3" into a value?

There is nothing wrong with the PHP, this sounds like an actionscript problem.
hi can anyone explain to me what is this part of the code doing?
[PHP]
$report.="name".$names--."=".$list."&";


[/PHP]
Jul 20 '07 #5

code green
Expert 100+
P: 1,726
can anyone explain to me what is this part of the code doing?
[PHP]$report.="name".$names--."=".$list."&";[/PHP] It is concatenating the following string onto the current value of $report
Expand|Select|Wrap|Line Numbers
  1. the word "name" + the value of $names-- + equals sign("=") + value of $list + ampersand ("&")
Jul 20 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.