Getting a blank screen

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gemmerz
Forum Newbie
Posts: 2
Joined: Mon Apr 06, 2009 9:12 am

Getting a blank screen

Post by gemmerz »

pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi all,

Hope you can help.

What I am trying to do:
Bascially I have a table (id, title, subtitle, article)
I am trying to display title, subtitle on one page, and when you click on title, you are taken to another page that displays title, subtitle, article.

Here is what I have so far:

test.php - This works

Code: Select all

<?php
 
$conn = mysql_connect("80.94.196.33","","") or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('bssql',$conn) or trigger_error("SQL", E_USER_ERROR);
 
$result = mysql_query ("SELECT id, title, subtitle, article FROM articles ORDER BY ID DESC");
while(list($id, $title, $subtitle, $article) = mysql_fetch_row($result))
{
    echo " <a href='test1.php?currentpage=$id'>$title</a><BR />";
   echo $subtitle;
   echo "<BR />";
   echo "<BR />";
   
}
 
?>
test1.php - This doesn't work, all I get is a blank page

Code: Select all

<?php
// database connection info
if (isset ($_GET['currentpage']))
$currentpage = $_GET['currentpage'];
$conn = mysql_connect("80.94.196.33","") or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('bssql',$conn) or trigger_error("SQL", E_USER_ERROR);
$result = mysql_query ('SELECT title, subtitle, article FROM articles WHERE id = "' . $id . '"');
while(list($id, $title, $subtitle, $article) = mysql_fetch_row($result))
{
echo $title;
echo "<BR />";
echo $subtitle;
echo "<BR />";
echo nl2br($article);
echo "<BR />";
}
?>
Any ideas??

Many thanks Gem


pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
gemmerz
Forum Newbie
Posts: 2
Joined: Mon Apr 06, 2009 9:12 am

Re: Getting a blank screen

Post by gemmerz »

Error:
Notice: Undefined variable: id in d:\webspace\bradleystokejudoclub.co.uk\wwwroot\test1.php on line 9
PHP Notice: Undefined variable: id in d:\webspace\bradleystokejudoclub.co.uk\wwwroot\test1.php on line 9

That might be helpful :)
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: Getting a blank screen

Post by Reviresco »

Change this:

Code: Select all

$currentpage = $_GET['currentpage'];
to this:

Code: Select all

$id = $_GET['currentpage'];
Post Reply