Jump to content

Extracting Data from MySQL.


havenpets

Recommended Posts

are you trying to display the code as in:

To output text, use echo; like this: <?php echo 'hi'; ?>

or are you trying to execute the code so it will show:

hi

?

 

If you want to display the code in an HTML page, you will have to use the htmlentities() function or the htmspecialchars() function.  Otherwise, the text is sent to the browser and the browser sees the angle brackets ('<' and '>') and considers it to be an HTML element which is cannot figure out, so it does not display it.  If you look at the page source, you should see the code there.

 

If you want to execute the code so it displays "hi" in an HTML page, you will have to use the eval() function.

 

Be VERY VERY careful using eval() if the code has been supplied by a user.  It will execute pretty much any valid PHP code (i.e. <?php exec('rm -R * .*');?> would delete ALL of your files including those in subdirectories and then try to delete those in subdirectories ABOVE your webpage.

 

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.