| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| SQLdumpster.com | PHP eval() Hey, Does anyone know how to use the eval function. I wanna output a variable which is stored in a mySQL database but I keep getting this stupid error. Parse error: syntax error, unexpected T_STRING in /home/.eurypides/npsale/vezor.net/certificate.php(39) : eval()'d code on line 1 I'm guessing there's an error in the entry in the database but i removed the text apart from the variable and still nothing. PHP Code: Thanks
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #3 (permalink) |
| SQLdumpster.com | Yeah, it works but the variable just reads $variable.. if that makes sense
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #4 (permalink) |
| NamePros Member | the eval function is not what you should use to output variables. Use print() instead. The eval() function evaluates whatever string you put inside of it as PHP code: print('hello'); //prints to the browser: hello eval('hello'); //is equivalent to typing "hello" as that LINE OF CODE print('$cert=2;') // prints to the browser: $cert=2; eval('$cert=2;') // is the equivalent of typing "$cert=2;" as that LINE OF CODE eval('$cert=2;'); print($cert); //will print the value "2" because it is the same as saying: $cert=2; print($cert); |
| |
| | #5 (permalink) |
| SQLdumpster.com | I get what you're saying Mike, but it still displays "$url" in the text. $url is the variable in the database. $certext is the text which the variable is in. Thanks for the help though Mike I think it may be the way I've set it up, I set the variable $url first. 1. $url is set 2. Row ($certext) from MySQL database is taken with "$url" within the text. 3. Need to print $certext.
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #6 (permalink) |
| SQLdumpster.com | I think it may have something to do with my host even. Every page on my website has: PHP Code: PHP Code:
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #8 (permalink) |
| SQLdumpster.com | Get the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/.eurypides/npsale/vezor.net/certificate.php on line 38 But thanks anyway
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #9 (permalink) |
| Senior Member | It could be something simple. try this; Code: $certext = stripslashes($row['certext']); eval($certext);
__________________ You design in photoshop, I code into valid XHTML/CSS. Professional PSD, PNG or HTML to tableless XHTML/CSS designs. For more info, send me a PM. |
| |
| | #11 (permalink) |
| SQLdumpster.com | Nah, still no worky. Not to worry. I'll try a different approach. Thanks anyway Scott
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #13 (permalink) |
| SQLdumpster.com | Thanks Jim!
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #15 (permalink) | |
| NamePros Member | Quote:
Is your variable called $page or $pagetitle? If this is the code you have in your files, there is no variable named $pagetitle. | |
| |
| | #17 (permalink) |
| SQLdumpster.com | I've been trying to sort this all afternoon. It is still displaying $variable. I've got rid of all the Errors but it is still not working!! It works when there is just $variable; in the database but I need text with $variable in.
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets Last edited by miseria; 04-02-2006 at 01:18 PM. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |