Blocks or snippets of PHP code appear on my web page suddenly, as if they were not recognized as PHP code. I have worked on this before, and I canβt think of anything that I changed or did, it would stop him from working! I spent so much time for Apache, MySQL, and PHP to work together in the first place, and now that. I am ready to tear my hair!
Example 1:
Example 1: (note that on the web page one block of php code is displayed, and the other is not!)
<fieldset> <legend>Enter SELECT statement:</legend> <textarea name="select" style="width: 100%; margin-bottom: 10px;"> <?php if (isset($_POST['select']) echo $_POST['select']; ?> </textarea> <input type="submit" value="Search" /> <?php echo "hello world!"; if (isset($_POST['select']) { if (!$results = mysql_query($_POST['select'])) die("Error: " . mysql_error()); } ?> </fieldset>
Example 2: 
Code Example 2:
<fieldset> <legend>Tags:</legend> <table class="tagstable"> <tr class="tagsrow"> </tr> <?php $query = "SHOW COLUMNS FROM recipes LIKE 'Tags'"; if (!($ret = mysql_query($query))) die("Error - could not show columns: " . mysql_error()); if(mysql_num_rows($ret)>0){ $row=mysql_fetch_row($ret); $options=explode("','",preg_replace("/(enum|set)\('(.+?)'\)/","\\2",$row[1])); } foreach ($options as $tag) { echo '<script type="text/javascript">addTag("' . $tag . '", false)</script>'; } ?> </table> <br> <input type="text" id="addtag"><input type="submit" value="Add"> </fieldset>
Troubleshooting:
- My phpinfo (); page works as expected
- The folder containing php.exe is included in my PATH
- Apache trial restart
- Follow all steps in answering this question.
- Using Apache 2.2.22, MySQL Server 5.5.24, PHP 5.4.3, Windows 7
Apache httpd.conf contains:
LoadModule php5_module "c:/websites/php/php5apache2_2.dll" <IfModule dir_module> DirectoryIndex index.html index.htm index.php </IfModule> AddType application/x-httpd-php .php PHPIniDir "C:/websites/php"
Anything left that I didnβt think of?
Thanks!
html php mysql apache
torjinx
source share