Re: [PHP] eval error
At 12:54 10-3-03, you wrote: what problem I want to use eval in my script but its generate this error : Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(22) : eval()'d code on line 4 eval ("\$all_types_list .= \"$all_types_list\";"); For those who do not know what all the CAPITALIZED secret words in error messages mean: i found a list of them on http://www.zend.com/manual/tokens.php. A T_LNUMBER is an integer. I __suppose__ that $all_types_list contains a number, maybe 144, and while you mean to do $all_types_list.="144"; the eval function somehow evaluates $all_types_list.=144; And .= expects a string on the right side, not an integer. Maybe someone who is more experienced with eval() can shed more light on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eval error
try echo "\$all_types_list .= \"$all_types_list\";"; there should be a syntax error Alawi wrote: what problem I want to use eval in my script but its generate this error : Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(22) : eval()'d code on line 4 Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(22) : eval()'d code on line 4 Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(40) : eval()'d code on line 4 Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(40) : eval()'d code on line 4 Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(40) : eval()'d code on line 4 Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(40) : eval()'d code on line 4 A { font-style : normal;text-decoration : none;} this is the cod from line 18 WHILE (!$ALL_TYPES_RS->EOF) { //vars extract($ALL_TYPES_RS->fields,EXTR_OVERWRITE); //eval eval ("\$all_types_list .= \"$all_types_list\";"); $ALL_TYPES_RS->MoveNext(); } $contform = put_sun_in_father("ALL_TYPES", $all_types_list, "contform"); - Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, and more -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Eval error
Felipe Coury wrote: > > Hi, > > I am a beginner in PHP and I am trying to do the following: I have a form in > a page that has 3 fields: email_1, email_2 and email_3. I am trying to send > e-mail to those people, if the fields are filled. Relevant part of code: > > for ($i = 1; $i <= 6; $i++) { > $eval = '\$email = \$email_' + $i + ';'; > eval( $eval ); > echo $email; > } > ?> > > The code complains about an error in line eval( $eval );: > > Parse error: parse error in > /home/httpd/htdocs/hthcombr/cgi-local/envia.php(19) : eval()'d code on line > 1 > > Can anyone please help me? > Use arrays, it's much easier. Set name of fields like this: email[0], email[1] and email[2]. Now after submitting the form you have array $email. And for-loop will be: Hope this helps. -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Eval error
lots of things: 1) variables in single-quoted strings aren't evaluated so you don't need to escape the $ in $email 2) php uses . not + for concatenation. 3) try it like this: eval('$email = $email_'.$i.';'); or eval("\$email = \$email_$i;"); 4) you can save yourself the trouble by using arrays as field names: 5) RTFM! that's what its there for. On Wed, 15 Aug 2001 15:15:09 -0300, Felipe Coury ([EMAIL PROTECTED]) wrote: >Hi, > >I am a beginner in PHP and I am trying to do the following: I have a >form in >a page that has 3 fields: email_1, email_2 and email_3. I am trying >to send >e-mail to those people, if the fields are filled. Relevant part of >code: >for ($i = 1; $i <= 6; $i++) { >$eval = '\$email = \$email_' + $i + ';'; >eval( $eval ); >echo $email; >} >?> > >The code complains about an error in line eval( $eval );: > >Parse error: parse error in >/home/httpd/htdocs/hthcombr/cgi-local/envia.php(19) : eval()'d code >on line >1 > >Can anyone please help me? > >Regards, > >Felipe Coury > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: php-list- >[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]