Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-13-2012, 07:40 AM   PM User | #1
HDRebel88
Regular Coder

 
Join Date: May 2011
Posts: 112
Thanks: 11
Thanked 5 Times in 5 Posts
HDRebel88 is an unknown quantity at this point
Page Returns Blank

I can't for the life of me figure out why this page is returning blank. The DB connects without an issue, but I don't see anything at all on the page.

PHP Code:
elseif(isset($_GET['castandcrew'])){
error_reporting(E_ALL);
$host=""// Host name 
$db_username=""// Username 
$db_password=""// Password 
$db_name="";
$findingme_db=mysqli_connect("$host""$db_username""$db_password""$db_name")or die("cannot connect");
$title="Cast and Crew";
$content2='<div class="castcrew_bio_wrapper">
<div class="castcrew_wrapper">'
;
$findingme_result=mysqli_query($findingme_db"SELECT * FROM `castandcrew`");
$current_state=false;
while(
$findingme_row=mysqli_fetch_assoc($findingme_result)){
if(
$findingme_row['name']!="Morgan Hennum"){
$cast_crew_url='/castandcrew/';
$cast_crew_url.=str_replace(" """strtolower($findingme_row['name']));
}
else{
$cast_crew_url="/castandcrew";
}
    if(
$current_state!=$findingme_row['crew_cast']){
    
$current_state=$findingme_row['crew_cast'];
    
$content2.='<div class="castcrew_title">'.ucfirst($findingme_row['crew_cast']).'</div>';
    }
    if(
$findingme_row['name']!=''){
    
$content2.='<div class="castcrew_entry"><a href="'.$cast_crew_url.'">'.ucwords($findingme_row['name']).'</a></div>';
    }
}
$content2.='
</div>
</div>'
;
}
$content=pagetitle($title).$content2

Last edited by HDRebel88; 12-13-2012 at 06:29 PM..
HDRebel88 is offline   Reply With Quote
Old 12-13-2012, 08:28 AM   PM User | #2
poyzn
Regular Coder

 
poyzn's Avatar
 
Join Date: Nov 2010
Posts: 265
Thanks: 2
Thanked 61 Times in 61 Posts
poyzn is on a distinguished road
where is echo $content ?
__________________
Ushousebuilders.com
poyzn is offline   Reply With Quote
Old 12-13-2012, 11:29 AM   PM User | #3
lewisstevens1
New Coder

 
Join Date: Apr 2008
Posts: 22
Thanks: 3
Thanked 0 Times in 0 Posts
lewisstevens1 is an unknown quantity at this point
poyzn is right just add:

echo $content;
lewisstevens1 is offline   Reply With Quote
Old 12-13-2012, 04:40 PM   PM User | #4
HDRebel88
Regular Coder

 
Join Date: May 2011
Posts: 112
Thanks: 11
Thanked 5 Times in 5 Posts
HDRebel88 is an unknown quantity at this point
Sorry left out the detail that this page is included in to another echo $content already is.
HDRebel88 is offline   Reply With Quote
Old 12-13-2012, 04:54 PM   PM User | #5
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
After your error_reporting() call add:
PHP Code:
ini_set('display_errors'true); 
Inigoesdr is offline   Reply With Quote
Old 12-13-2012, 05:28 PM   PM User | #6
HDRebel88
Regular Coder

 
Join Date: May 2011
Posts: 112
Thanks: 11
Thanked 5 Times in 5 Posts
HDRebel88 is an unknown quantity at this point
Still a blank page after I add that... http://www.findingmemovie.com/index2.php Click the Cast & Crew link.

content.php
PHP Code:
<?php
function copyyear($setyear){
    return (
"© $setyear" . ((date('Y') != $setyear)? " - " date('Y') : ''));
}
function 
pagetitle($title_text){
    return (
"<div class=\"page_header\">$title_text</div>");
}


if(isset(
$_GET['about'])){
$title="About";
}
elseif(isset(
$_GET['castandcrew'])){
error_reporting(E_ALL);
ini_set('display_errors'true);
$host=""// Host name 
$db_username=""// Username 
$db_password=""// Password 
$db_name="";
$findingme_db=mysqli_connect("$host""$db_username""$db_password""$db_name")or die("cannot connect");
$title="Cast and Crew";
$content2='<div class="castcrew_bio_wrapper">
<div class="castcrew_wrapper">'
;
$findingme_result=mysqli_query($findingme_db"SELECT * FROM `castandcrew`");
$current_state=false;
while(
$findingme_row=mysqli_fetch_assoc($findingme_result)){
$cast_crew_url2=str_replace(" """strtolower($findingme_row['name']));
if(
$cast_crew_url2!="morganhennum"){
$cast_crew_url="/castandcrew/$cast_crew_url2";
}
else{
$cast_crew_url="/castandcrew";
}
    if(
$current_state!=$findingme_row['crew_cast']){
    
$current_state=$findingme_row['crew_cast'];
    
$content2.='<div class="castcrew_title">'.ucfirst($findingme_row['crew_cast']).'</div>';
    }
    if(
$findingme_row['name']!=''){
    
$content2.='<div class="castcrew_entry"><a href="'.$cast_crew_url.'">'.ucwords($findingme_row['name']).'</a></div>';
    }
}
$content2.='
</div>
</div>'
;
}
elseif(isset(
$_GET['video'])){
$title="Video";
}
elseif(isset(
$_GET['stills'])){
$title="Stills";
}
elseif(isset(
$_GET['investors'])){
$title="Investors";
$content2='
<div class="investors">
We welcome the opportunity to speak with investors regarding our film project.<br />
You may contact us a <a href="mailto:investors@findingmemovie.com">investors@findingmemovie.com</a> for details on our projects.
<br />
<br />
<span class="disclosure">The information on this website is not to be construed as an offer to sell, or a solicitation of an offer to buy, securities. <br />
An investment in any security can only be made pursuant to an offering memorandum or disclosure document, the delivery of which has been 
authorized by Finding Me Productions, L.L.C.</span>
</div>
'
;
}
else{
$content2='<div class="page_header">Home</div>';
}

$content=pagetitle($title).$content2;

?>
index.php aka layout
PHP Code:
<?php
require 'content.php';
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<base href="http://www.findingmemovie.com/" />
<title>Finding Me - The Movie<?php if(isset($title)){ echo " - $title";} ?></title>
<meta charset="UTF-8" />
<meta name="keywords" content="Production, Area 51, Area 51 Entertainment, Film, Movie, Movies, Films, Television, Show, Shows, Web, Webseries, Web-Series,
Andrew, McCarrick, Finding Me, Finding, Me, crash, car, auto, automobile, fight, fighting, bully, bullies, sisters, sister" />
<meta name="description" content="Finding Me - After her sister's tragic death,12 year-old Erin O’Connor vows bloody revenge when she learns the truth about what really happened." />
<meta name="author" content="Andrew McCarrick" />
<meta name="robots" content="index, follow" />
<link rel="stylesheet" href="/style_site.css" media="screen" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<div class="top_bar">
<div class="links_left">
<div class="top_link"><a href="/index2.php">Home</a></div>
<div class="top_link"><a href="/about">About</a></div>
<div class="top_link"><a href="/castandcrew">Cast & Crew</a></div>
</div>
<div class="title">FINDING ME</div>
<div class="links_right">
<div class="top_link"><a href="/video">Video</a></div>
<div class="top_link"><a href="/stills">Stills</a></div>
<div class="top_link"><a href="/investors">Investors</a></div>
</div>
</div>
<div class="content">
<?php
echo $content;
?>
</div>
<div class="footer_wrapper">
<div class="footer_left footer_text">
<?php echo copyyear(2012)." Finding Me Productions, L.L.C. All rights reserved."?>
</div>
<div class="links_right">
</div>
<div class="prodco_donors">
<div class="prodco">
<a href="http://www.area51entertainment.co/" target="_new"><img class="prodco_logo" src="area51.png" /></a>
</div>
<div class="donors">
<span class="bold">Fundraiser Donors:</span>
Christopher Barrett, Amelia Ortman, Steve Daniels, Moira Black, Gary Damm, Christine Koehler, <br /> Morgan Hennum, Andrew Willmott, Eric Paperth, 
Andrew McCarrick, Sabina G. Kufner, Samuel Kpakiwa, Alyssa Ruland, Lisa Hoffman, Jennifer Colletti, Giles Shepherd, Michele Reeve, Marie Balitsos, 
And a few Annonymous Donors
</div>
</div>
</div>
</body>
</html>

Last edited by HDRebel88; 12-13-2012 at 05:32 PM..
HDRebel88 is offline   Reply With Quote
Old 12-13-2012, 05:53 PM   PM User | #7
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
The cast and crew link points to a page 'castandcrew' without the .php extension (if the php code is not run then it results in a blank page). I suggest this may be the cause, or your file re-directions are not set up correctly.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
HDRebel88 (12-13-2012)
Old 12-13-2012, 06:01 PM   PM User | #8
HDRebel88
Regular Coder

 
Join Date: May 2011
Posts: 112
Thanks: 11
Thanked 5 Times in 5 Posts
HDRebel88 is an unknown quantity at this point
Using Mod-Rewrite... All the other pages are functioning as they should with mod-rewrite... no reason this one isn't either.

EDIT: Actually it looks like mod-rewrite might be the issue because this URL works: http://www.findingmemovie.com/index2.php?castandcrew

Here's the mod re-write:

Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^findingmemovie\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.findingmemovie\.com$
RewriteRule ^donate$ "http://www.indiegogo.com/findingme2/x/538302" [R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)(/([^/]+))?/?$ /index2.php?$1=$3 [QSA]
It works for everything else though.

It worked previously, prior to me switching over to using a database, when I had all the links in the list hard coded in.

Last edited by HDRebel88; 12-13-2012 at 06:06 PM..
HDRebel88 is offline   Reply With Quote
Old 12-13-2012, 06:27 PM   PM User | #9
HDRebel88
Regular Coder

 
Join Date: May 2011
Posts: 112
Thanks: 11
Thanked 5 Times in 5 Posts
HDRebel88 is an unknown quantity at this point
It was working all along... I'm on 1and1 and they have this stupid thing where if they find a folder or file with a name (aka /castandcrew) that doesn't exist, the server automatically finds a file name with something similar i.e; castandcrew.php. And I had a castandcrew.php file uploaded, thus it loaded that, which was blank.

Of course all of that auto detecting and rerouting is done prior to my .htaccess rule, so it overwrote my rule.


Thanks guys for helping me try to figure this out.

AndrewGSW your post was what ultimately made figure out what was happening so thanks.

Last edited by HDRebel88; 12-13-2012 at 06:33 PM..
HDRebel88 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:09 PM.


Advertisement
Log in to turn off these ads.