Blank Page?
am 03.09.2008 21:29:04 von Chris Hale
I have a functions page:
function connect()
{
include("includes/Vars.php");
mysql_connect($host, $user, $passwd) or die("Couldn't connect to
database");
mysql_select_db($db) or die("Couldn't select database");
}
function pagecontent()
switch($_GET[page])
{
connect();
case "about" :
$sql = "SELECT * FROM page WHERE name='about'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
extract($row)
echo
{$title}
;\n
echo $content ;
break;
case "contact" :
$sql = "SELECT * FROM page WHERE name='contact'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
extract($row)
echo {$title}
;\n
echo $content ;
break;
default :
$sql = "SELECT * FROM page WHERE name='home'";
$result = mysql_query($sql,$cxn);
$row = mysql_fetch_assoc($result);
extract($row)
echo {$title}
;\n
echo $content ;
break;
}
return;
}
and when i include that in another document and try and run the functions:
The page appears completely blank. Im new to this and i am struggling to
get anything to work.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Blank Page?
am 03.09.2008 21:31:50 von Evert Lammerts
Add the line:
error_reporting(E_ALL);
at the top of your functions page
On Wed, Sep 3, 2008 at 9:29 PM, Chris Hale wrote:
> I have a functions page:
> function connect()
> {
> include("includes/Vars.php");
> mysql_connect($host, $user, $passwd) or die("Couldn't connect to
> database");
> mysql_select_db($db) or die("Couldn't select database");
> }
> function pagecontent()
> switch($_GET[page])
> {
> connect();
> case "about" :
> $sql = "SELECT * FROM page WHERE name='about'";
> $result = mysql_query($sql);
> $row = mysql_fetch_assoc($result);
> extract($row)
> echo {$title}
;\n
> echo $content ;
> break;
> case "contact" :
> $sql = "SELECT * FROM page WHERE name='contact'";
> $result = mysql_query($sql);
> $row = mysql_fetch_assoc($result);
> extract($row)
> echo {$title}
;\n
> echo $content ;
> break;
> default :
> $sql = "SELECT * FROM page WHERE name='home'";
> $result = mysql_query($sql,$cxn);
> $row = mysql_fetch_assoc($result);
> extract($row)
> echo {$title}
;\n
> echo $content ;
> break;
> }
> return;
> }
> and when i include that in another document and try and run the functions:
>
>
>
> The page appears completely blank. Im new to this and i am struggling to get
> anything to work.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Blank Page?
am 03.09.2008 21:40:19 von Evert Lammerts
>switch($_GET[page])
> {
> connect();
> case "about" :
Put the connect() before the switch (and keep error_reporting(E_ALL)
at the top):
connect();
switch($_GET[page])
{
case "about" :
....
}
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php