Global variables question and a little bit of help needed
Posted: Wed Aug 28, 2002 4:05 am
Hi,
I'm learning since a couple of days a bit of php from a book called PHP Zonder Stress (Dutch for PHP without Stress).
Thanks to this section I figured out my problem.
Book examples were written in php 4.0.6 and I'm using 4.2.2
By turning the register_globals = On. The script in book works fine.
But I want to learn how to do it the right way.
So some help would be very much apreciated to convert the code to correct code for register_globals = Off.
Description:
In home.php there are articles listed, but limited to a display size of 40 characters. By clicking on the link "more" you go to the page news.php where the complete article is listed.
In news.php with the following code and with register_globals = Off, I get an Notice: undifined variable $news_ID.
Hoping someone could help me with this.
Thanks in advance,
Greetings from Belgium,
Gijs
I'm learning since a couple of days a bit of php from a book called PHP Zonder Stress (Dutch for PHP without Stress).
Thanks to this section I figured out my problem.
Book examples were written in php 4.0.6 and I'm using 4.2.2
By turning the register_globals = On. The script in book works fine.
But I want to learn how to do it the right way.
So some help would be very much apreciated to convert the code to correct code for register_globals = Off.
Description:
In home.php there are articles listed, but limited to a display size of 40 characters. By clicking on the link "more" you go to the page news.php where the complete article is listed.
Code: Select all
<a href=nieuws/news.php?news_ID=" . $newsї'news_ID'] . ">more</a>In news.php with the following code and with register_globals = Off, I get an Notice: undifined variable $news_ID.
Code: Select all
// Performing the query where the news_ID is loaded into the variable $news_ID
$news_SQL = "SELECT * FROM news WHERE news_ID='$news_ID'";
// Query results
$news_result = mysql_query($news_SQL) or die ("Error in query: $news_SQL. " . mysql_error());
$news = mysql_fetch_array($news_result);Thanks in advance,
Greetings from Belgium,
Gijs