Reputation: 830
I am having the following piece of code in a php file:
<?php
include_once('includes/connection.php');
include_once('includes/article.php');
$article = new Article;
$articles = $article->fetch_all();
?>
<html>....</html>
Instead of getting the expected result, I get the message "fetch_all(); ?>, which means that the above code is treated as HTML comment. I have read the similar threads(that blame the short_open_tag value mainly) around but didn't help me at all. Any ideas?
Edit: Many thanks for your responses. Seems that the specific weird problem was about an update on my Linux system which messed up a little my permissions. I changed the user to http instead of root and the problem is gone.
Upvotes: 0
Views: 1647
Reputation: 830
This specific problem was brought about by an update on my Linux system, which messed up my permissions a little. I changed the user in the Apache directory to http instead of root, and the problem is now gone.
Upvotes: 0
Reputation: 7026
In case you did not installed php. you might look at WAMP server. It includes php en mysql and works great on your local (windows) computer.
Upvotes: 1
Reputation: 6241
Is this your output?
Your code isn't being parsed by PHP and there might be several reasons for it:
Check your URL. Does it look like you're fetching the file directly (C:\Users\Name\...
) or are you going through your host http://localhost/file.php
.
Check your file extensions. Make sure it's .php and not .html.
Check your server capabilities. Is PHP installed?
Upvotes: 0
Reputation: 3280
The problem is somewhere inside either includes/connection.php
or includes/article.php
. A line in there seems to indicate the start of the comment which goes all the way down to the ->
part.
Upvotes: 1