2 questions. ( they may be non-related)
1.the code below lists the articles in a specific section ( part of the site ):
Code: Select all
<?
include 'global.php';
if (isset($_GET['id'])) {
$section_id = $_GET['id'];
$sql = "SELECT * FROM articles WHERE section = '$section_id' ORDER BY id";
$results = mysql_query($sql) or die (mysql_error());
$row = mysql_fetch_array($results);
include 'page.php';
}
?>Parse error: parse error in g:\programs(2)\easyphp1-8\www\takfekr\htdocs\section.php on line 10
do you think it's because there is no "else" for the if statement?
2. I am using a code that will include a page for 2 different purposes. I mean section.php includes it and read.php does as well. I named the result of the sql queries related to each of them different, $result for read.php and $results for section.php
Then I used if statement like this:
Code: Select all
if ($result){
//now the codes related for read.php goes here
} else{
//this means no sql query has been done named $result, so it assumes the page has been called for section.php
}Notice: Undefined variable: result in g:\programs(2)\easyphp1-8\www\takfekr\htdocs\articlecontent.php on line 3
I can use different pages to solve it, but is there another solution (except turning off notices)
thanks