Current location: Hot Scripts Forums » Programming Languages » PHP » PHP include not working in echo statement


PHP include not working in echo statement

Reply
  #1 (permalink)  
Old 07-02-06, 07:30 AM
mike_jandreau mike_jandreau is offline
Newbie Coder
 
Join Date: Jun 2006
Location: Boston
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
PHP include not working in echo statement

So, I had posted the other day, and got some great help. Now I'm stuck again.

I managed to get my if else statement working correctly. However, now, in my "include" statement, it won't work, when called from the "echo" statement, and I can't figure out why.

Here's my original code (which is sloppy, I know, I'm still learning)
PHP Code:

<?

$username
="XXXXXXXXXXXx";
$password="XXXXXXXX";
$database="XXXXXXXXXXXXX";

mysql_connect("XXXXXXXXXXXXXX",$username,$password);
@
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM reviews WHERE movieid='$movieid'";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo 
"";

$i=0;
//while ($i < $num) {
while ($row mysql_fetch_array($result)) {

$title $row['title'];
$stars $row['stars'];
$rating $row['rating'];
$main_cast $row['main_cast'];
$review $row['review'];
$runtime $row['runtime'];
$release_dvd $row['release_dvd'];
$release_theater $row['release_theater'];
$reviewed_by $row['reviewed_by'];
$links $row['links'];
$director $row['director'];
$writer $row['writer'];
$tags $row['tags'];
$poster $row['poster'];
$date_written $row['date_written'];
$page_title $row['page_title'];
$amazon $row['amazon'];
$netflix $row['netflix'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head><link rel="icon" href="http://www.moviesnobs.net/favicon.ico" type="image/bmp" />
<script language="JavaScript">
var arImages=new Array();
function Preload() {
 var temp = Preload.arguments; 
 for(x=0; x < temp.length; x++) {
  arImages[x]=new Image();
  arImages[x].src=Preload.arguments[x];
 }
}
 </script>

<meta NAME="description" CONTENT="Movie Snobs ; Movies Reviews by people who love movies">
<meta NAME="keywords" CONTENT="<? echo $tags?>">
<meta name="revisit-after" content="4days">
<meta name="robots" content="index,follow">

<title>Movie Snobs ; <? echo $page_title?></title>
<script>

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""

</script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>

<script type="text/javascript" src="http://www.moviesnobs.net/mover_script.js"></script>
<link rel="stylesheet" href="http://www.moviesnobs.net/style1.css" type="text/css" media="screen">
<script>
function popupWindow(link, width, height) {
     var trpopWin = window.open(link,"trpopWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable-0,width="+width+",height="+height);
}
</script></head>

<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" onload="Preload('images/bg_bottmenu.gif','images/bg_conbott.gif','images/bg_footer.gif','images/bg_head.gif','images/bg_menu.gif','images/bg_sidepanel.gif','images/bmenu_01.gif','images/bmenu_02.gif','images/bmenu_03.gif','images/bmenu_04.gif','images/bmenu_08.gif','images/box_01.gif','images/box_02.gif','images/box_03.gif','images/box_04.gif','images/box_05.gif','images/box_06.gif','images/box_08.gif','images/box_09.gif','images/box_10.gif','images/box_11.gif','images/box_12.gif','images/box_14.gif','images/box_17.gif','images/bullet.gif','images/buttbs_back.gif','images/buttbs_back_sel.gif','images/buttbs_home.gif','images/buttbs_home_sel.gif','images/buttbs_top.gif','images/buttbs_top_sel.gif','images/dfs_03.gif','images/dfs_08.gif','images/dfs_12.gif','images/logo.gif','images/pg_02.gif','images/pg_04.gif','images/pg_05.gif','images/pg_06.gif','images/pg_08.gif','images/pg_09.gif','images/pg_11.gif','images/spacer.gif','images/sub2_bullet.gif','images/sub_bullet.gif','images/subnav_bullet.gif','images/sub_bullet_dvd.gif','images/tmenu_01.gif','images/tmenu_02.gif','images/tmenu_03.gif','images/tmenu_04.gif','images/tmenu_05.gif','images/tmenu_07.gif','images/tmenu_08.gif','images/tmenu_11.gif','images/tmenu_12.gif','images/tmenu_13.gif','images/tmenu_14.gif','images/tmenu_head.gif')"><a name="top">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="http://www.moviesnobs.net/images/bg_head.gif" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="291" height="124">
<table width="280" border="0" cellpadding="0" cellspacing="0"><tr>
<td><http://www.moviesnobs.net/images/spacer.gif" width="1" height="1"><img src="http://www.moviesnobs.net/images/tmenu_01.gif" width="26" height="36"></td>
<td><img src="http://www.moviesnobs.net/images/tmenu_02.gif" width="78" height="36"><img src="http://www.moviesnobs.net/images/tmenu_03.gif" width="88" height="36"><img src="http://www.moviesnobs.net/images/tmenu_04.gif" width="88" height="36"></td>

</tr><tr>
<td rowspan="3"><img src="http://www.moviesnobs.net/images/spacer.gif" width="1" height="1"><img src="http://www.moviesnobs.net/images/tmenu_05.gif" width="26" height="64"></td>
<td rowspan="3"><img src="http://www.moviesnobs.net/images/tmenu_head.gif" width="79" height="64"><img src="http://www.moviesnobs.net/images/tmenu_07.gif" width="88" height="64"><img src="http://www.moviesnobs.net/images/tmenu_08.gif" width="88" height="64"></td>

</tr><tr>

</tr><tr>

</tr><tr>
<td><img src="http://www.moviesnobs.net/images/spacer.gif" width="1" height="1"><img src="http://www.moviesnobs.net/images/tmenu_11.gif" width="26" height="24"></td>
<td><img src="http://www.moviesnobs.net/images/tmenu_12.gif"  height="24"><img src="http://www.moviesnobs.net/images/tmenu_13.gif" width="88" height="24"><img src="http://www.moviesnobs.net/images/tmenu_14.gif" width="88" height="24"></td>

</tr>
</table>
</td>
<td width="716" height="124"><p align="right">
</p>

</td>
</tr>
</table>
</td>
</tr>
<tr>
<td background="http://www.moviesnobs.net/images/bg_menu.gif" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.moviesnobs.net/images/spacer.gif" width="1" height="1"><img src="http://www.moviesnobs.net/images/dfs_03.gif" width="215" height="36"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr></table></td>
</tr>
<tr>
<td height="100%" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="http://www.moviesnobs.net/images/bg_sidepanel.gif" width="212" height="100%" align="center" valign="top">
<!-- Side Panel -->

<!-- News -->
<table width="198" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<!-- Begin Reviews Box Box-->
<table width="198" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><img src="http://www.moviesnobs.net/images/box_01.gif" width="7" height="12"></td>
          <td colspan="2"><img src="http://www.moviesnobs.net/images/box_02.gif" width="186" height="12"></td>
          <td><img src="http://www.moviesnobs.net/images/box_03.gif" width="5" height="12"></td>
        </tr>
        <tr>
          <td><img src="http://www.moviesnobs.net/images/box_04.gif" width="7" height="21"></td>
          <td><img src="http://www.moviesnobs.net/images/box_05.gif" width="30" height="21"></td>
          <td background="http://www.moviesnobs.net/images/box_06.gif" width="156" height="21" class="sub_title"> Review Info </td>
          <td><img src="http://www.moviesnobs.net/images/box_08.gif" width="5" height="21"></td>
        </tr>
        <tr>
          <td><img src="http://www.moviesnobs.net/images/box_09.gif" width="7" height="10"></td>
          <td colspan="2"><img src="http://www.moviesnobs.net/images/box_10.gif" width="186" height="10"></td>
          <td><img src="http://www.moviesnobs.net/images/box_11.gif" width="5" height="10"></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><img src="http://www.moviesnobs.net/images/box_12.gif" width="7" height="100%"></td>
          <td bgcolor="#FAFAFA" width="186" height="43" valign="top">

<? echo ""$i++;} ?> <b>Movie Title:</b> <? echo $title?><br><b>Director:</b> <? echo $director?><br><b>Written by:</b> <? echo $writer?><br> <b>Main Cast:</b> <? echo $main_cast?><br><b>MPAA Rating:</b> <? echo $rating?><br><b>Runtime:</b> <? echo $runtime ?><br> <b>Reviewed by: </b><? echo $reviewed_by?><br>
<B>Snob-Rating:</b><br><center><img src="http://www.moviesnobs.net/images/stars/<? echo $stars?>.gif" alt="Rating"></center>
<hr width="100%" size="1" color="#B2B2B2" noshade><br><b>Release Date:</b> <? echo $release_theater?><br><b>DVD Release Date:</b> <? echo $release_dvd?><br><img src="http://www.moviesnobs.net/images/sub_bullet.gif" alt=""> <a href="http://www.netflix.com/AddToQueue?movieid=<? echo $netflix?>" target="_blank" onmouseover="window.status='';return true" onmouseout="window.status='';return true" target="_blank" title="Add <? echo $title?> To Your Netflix Queue">Netflix <? echo $title?> </a><Br><img src="http://www.moviesnobs.net/images/sub_bullet.gif" alt=""> <a href=" <? echo $amazon?>" title="Buy <? echo $title?> at Amazon.com" target="_blank" onmouseover="window.status='';return true" onmouseout="window.status='';return true">Buy <? echo $title?> at Amazon</a><img src="http://www.assoc-amazon.com/e/ir?t=moviesnobs-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br>
             
          </td>
          <td><img src="http://www.moviesnobs.net/images/box_14.gif" width="5" height="100%"></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="http://www.moviesnobs.net/images/box_17.gif" width="198" height="8"></td>
  </tr>
</table>
<!-- End Reviews Box Box --><? include("boxes/boxes.php"?>

<p>&nbsp;</p></td>
<td width="785" height="339" valign="top">

<table height="100%" border="0" cellpadding="6" cellspacing="0" width="768"><tr>
<p>&nbsp;<br> <!-- Begin Body Here --> 



<center><span class="castlarge"><? echo "$title"?></span><br>
Review written on <? echo "$date_written"?><br><br><img src="http://www.moviesnobs.net/images/content/email_send.gif" alt=""> <a href="refer_a_review.php" onmouseover="window.status='';return true" onmouseout="window.status='';return true" target="_blank" title="Send this review to a friend!">E-mail this review to a friend</a> <img src="http://www.moviesnobs.net/images/content/printer.gif" alt=""> <a href="print_view.php?movieid=<? echo "$movieid"?>" target="_blank" title="Printable Version">Printable View</a></center><Br>
<blockquote><blockquote><img src="http://www.moviesnobs.net/images/posters/<? echo "$poster"?>"  border="2" align="right" hspace="15" vspace="5" alt="<? echo $page_title?>"><? echo "$review"?><p><B>See more reviews for the main cast of <? echo "$title"?></b>: <? echo $main_cast?></blockquote></blockquote>

      <!--End  Body -->
    </td></tr></table>

</td>
</tr>
</table>

<tr>
<td background="http://www.moviesnobs.net/images/bg_conbott.gif" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="28"><img src="http://www.moviesnobs.net/images/bmenu_01.gif" width="28" height="37"></td>
<td width="24"><img src="http://www.moviesnobs.net/images/bmenu_02.gif" width="24" height="37"></td>
<td width="22"><img src="http://www.moviesnobs.net/images/bmenu_03.gif" width="22" height="37"></td>
<td width="66"><img src="http://www.moviesnobs.net/images/bmenu_04.gif" width="66" height="37"></td>
<td width="75"><img src="http://www.moviesnobs.net/images/dfs_12.gif" width="75" height="37"></td>
<td width="788" height="37"></td>
</tr>
</table></td>
</tr>
<tr>
<td background="http://www.moviesnobs.net/images/bg_bottmenu.gif" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="http://www.moviesnobs.net/index.php" onmouseover="on8();" onmouseout="off8();"><img src="http://www.moviesnobs.net/images/buttbs_home.gif" width="28" height="24" border="0" name="h" onmouseover="window.status='Home Page';return true" onmouseout="window.status='';return true"></a></td>
<td><a href="javascript:history.back(1)" onmouseover="on9();" onmouseout="off9();"><img src="http://www.moviesnobs.net/images/buttbs_back.gif" width="24" height="24" border="0" name="i" onmouseover="window.status='Back A Page';return true" onmouseout="window.status='';return true"></a></td>
<td><a href="#top" onmouseover="on10();" onmouseout="off10();"><img src="http://www.moviesnobs.net/images/buttbs_top.gif" width="22" height="24" border="0" name="j" onmouseover="window.status='Top Of Page';return true" onmouseout="window.status='';return true"></a></td>
<td><img src="http://www.moviesnobs.net/images/bmenu_08.gif" width="66" height="24" border="0"></td>

</tr>
</tr>
</table></td>
</tr>
<tr>
<td background="http://www.moviesnobs.net/images/bg_footer.gif" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.moviesnobs.net/images/spacer.gif" width="770" height="40"></td>
</tr>
</table></td>
</tr>
</table>
 <? include("footer.php"?>
</body>
</html>
                        </span></center><br><br>
My php includes work fine in this context. However, here's the code I'm trying to change to (to handle errors better), and the php includes don't work in my echo statement. Any ideas why?

PHP Code:

<?

$username
="XXXXXXXXX";
$password="XXXXXXXXX";
$database="XXXXXXXXXXXXX";

mysql_connect("XXXXXXXXXX",$username,$password);
@
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM reviews WHERE movieid='$movieid'";   
$result mysql_query($query) or die('Query failed: ' mysql_error()); 

$num=mysql_numrows($result);

mysql_close();

echo 
"";

//while ($i < $num) {
while ($row mysql_fetch_array($result)){
$tags $row['tags'];
$stars $row['stars'];
$rating $row['rating'];
$main_cast $row['main_cast'];
$review $row['review'];
$runtime $row['runtime'];
$release_dvd $row['release_dvd'];
$release_theater $row['release_theater'];
$reviewed_by $row['reviewed_by'];
$links $row['links'];
$director $row['director'];
$writer $row['writer'];
$tags $row['tags'];
$poster $row['poster'];
$date_written $row['date_written'];
$page_title $row['page_title'];
$amazon $row['amazon'];
$netflix $row['netflix'];
$title $row['title'];
}
?>

<?
if(mysql_num_rows($result) === 0
    { 
       echo 
"No Movie Review Found"// echo message that there is no movie that matched the request 
    


else { 
       echo 
"<meta NAME=\"description\" CONTENT=\"Movie Snobs Movies Reviews by people who love movies\">
<meta NAME=\"keywords\" CONTENT=\"
$tags\">
<meta name=\"revisit-after\" content=\"4days\">
<meta name=\"robots\" content=\"index,follow\">
<title>Movie Snobs - 
$page_title</title>
<script>

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = \"\"

</script>
<script type=\"text/javascript\" src=\"http://www.moviesnobs.net/mover_script.js\"></script>
<link rel=\"stylesheet\" href=\"http://www.moviesnobs.net/style1.css\" type=\"text/css\" media=\"screen\">
<script>
function popupWindow(link, width, height) {
     var trpopWin = 

window.open(link,\"trpopWin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable-0,width=\"+width+\",height=\"+height);
}
</script></head>
<body marginwidth=\"0\" marginheight=\"0\" leftmargin=\"0\" topmargin=\"0\" 

onload=\"Preload('images/bg_bottmenu.gif','images/bg_conbott.gif','images/bg_footer.gif','images/bg_head.gif','images/bg_menu.gif','images/bg_sidepanel.gif',

'images/bmenu_01.gif','images/bmenu_02.gif','images/bmenu_03.gif','images/bmenu_04.gif','images/bmenu_08.gif','images/box_01.gif','images/box_02.gif','images

/box_03.gif','images/box_04.gif','images/box_05.gif','images/box_06.gif','images/box_08.gif','images/box_09.gif','images/box_10.gif','images/box_11.gif','ima

ges/box_12.gif','images/box_14.gif','images/box_17.gif','images/bullet.gif','images/buttbs_back.gif','images/buttbs_back_sel.gif','images/buttbs_home.gif','i

mages/buttbs_home_sel.gif','images/buttbs_top.gif','images/buttbs_top_sel.gif','images/dfs_03.gif','images/dfs_08.gif','images/dfs_12.gif','images/logo.gif',

'images/pg_02.gif','images/pg_04.gif','images/pg_05.gif','images/pg_06.gif','images/pg_08.gif','images/pg_09.gif','images/pg_11.gif','images/spacer.gif','ima

ges/sub2_bullet.gif','images/sub_bullet.gif','images/subnav_bullet.gif','images/sub_bullet_dvd.gif','images/tmenu_01.gif','images/tmenu_02.gif','images/tmenu

_03.gif','images/tmenu_04.gif','images/tmenu_05.gif','images/tmenu_07.gif','images/tmenu_08.gif','images/tmenu_11.gif','images/tmenu_12.gif','images/tmenu_13

.gif','images/tmenu_14.gif','images/tmenu_head.gif')\"><a name=\"top\">
<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td background=\"http://www.moviesnobs.net/images/bg_head.gif\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"291\" height=\"124\">
<table width=\"280\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>
<td><img src=\"http://www.moviesnobs.net/images/spacer.gif\" width=\"1\" height=\"1\"><img src=\"http://www.moviesnobs.net/images/tmenu_01.gif\" width=\"26\" 

height=\"36\"></td>
<td><img src=\"http://www.moviesnobs.net/images/tmenu_02.gif\" width=\"78\" height=\"36\"><img src=\"http://www.moviesnobs.net/images/tmenu_03.gif\" 

width=\"88\" height=\"36\"><img src=\"http://www.moviesnobs.net/images/tmenu_04.gif\" width=\"88\" height=\"36\"></td>

</tr><tr>
<td rowspan=\"3\"><img src=\"http://www.moviesnobs.net/images/spacer.gif\" width=\"1\" height=\"1\"><img 

src=\"http://www.moviesnobs.net/images/tmenu_05.gif\" width=\"26\" height=\"64\"></td>
<td rowspan=\"3\"><img src=\"http://www.moviesnobs.net/images/tmenu_head.gif\" width=\"79\" height=\"64\"><img 

src=\"http://www.moviesnobs.net/images/tmenu_07.gif\" width=\"88\" height=\"64\"><img src=\"http://www.moviesnobs.net/images/tmenu_08.gif\" width=\"88\" 

height=\"64\"></td>

</tr><tr>
</tr><tr>

</tr><tr>
<td><img src=\"http://www.moviesnobs.net/images/spacer.gif\" width=\"1\" height=\"1\"><img src=\"http://www.moviesnobs.net/images/tmenu_11.gif\" width=\"26\" 

height=\"24\"></td>
<td><img src=\"http://www.moviesnobs.net/images/tmenu_12.gif\"  height=\"24\"><img src=\"http://www.moviesnobs.net/images/tmenu_13.gif\" width=\"88\" 

height=\"24\"><img src=\"http://www.moviesnobs.net/images/tmenu_14.gif\" width=\"88\" height=\"24\"></td>

</tr>
</table>
</td>
<td width=\"716\" height=\"124\"><p align=\"right\"><script type=\"text/javascript\"><!--
google_ad_client = \"pub-6708600750793239\";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = \"468x60_as\";
google_ad_type = \"text\";
google_ad_channel =\"\";
google_color_border = \"CA5B00\";
google_color_link = \"CA5B00\";
google_color_bg = \"EEEEEE\";
google_color_text = \"000000\";
google_color_url = \"CA5B00\";
//--></script>
<script type=\"text/javascript\"
  src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>
</p>

</td>
</tr>
</table>
</td>
</tr>
<tr>
<td background=\"http://www.moviesnobs.net/images/bg_menu.gif\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td><img src=\"http://www.moviesnobs.net/images/spacer.gif\" width=\"1\" height=\"1\"><img src=\"http://www.moviesnobs.net/images/dfs_03.gif\" width=\"215\" 

height=\"36\"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr></table></td>
</tr>
<tr>
<td height=\"100%\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td background=\"http://www.moviesnobs.net/images/bg_sidepanel.gif\" width=\"212\" height=\"100%\" align=\"center\" valign=\"top\">
<!-- Side Panel -->

<!-- News -->
<table width=\"198\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
  <tr>
    <td>
<!-- Begin Reviews Box Box-->
<table width=\"198\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
  <tr>
    <td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
        <tr>
          <td><img src=\"http://www.moviesnobs.net/images/box_01.gif\" width=\"7\" height=\"12\"></td>
          <td colspan=\"2\"><img src=\"http://www.moviesnobs.net/images/box_02.gif\" width=\"186\" height=\"12\"></td>
          <td><img src=\"http://www.moviesnobs.net/images/box_03.gif\" width=\"5\" height=\"12\"></td>
        </tr>
        <tr>
          <td><img src=\"http://www.moviesnobs.net/images/box_04.gif\" width=\"7\" height=\"21\"></td>
          <td><img src=\"http://www.moviesnobs.net/images/box_05.gif\" width=\"30\" height=\"21\"></td>
          <td background=\"http://www.moviesnobs.net/images/box_06.gif\" width=\"156\" height=\"21\" class=\"sub_title\"> Review Info </td>
          <td><img src=\"http://www.moviesnobs.net/images/box_08.gif\" width=\"5\" height=\"21\"></td>
        </tr>
        <tr>
          <td><img src=\"http://www.moviesnobs.net/images/box_09.gif\" width=\"7\" height=\"10\"></td>
          <td colspan=\"2\"><img src=\"http://www.moviesnobs.net/images/box_10.gif\" width=\"186\" height=\"10\"></td>
          <td><img src=\"http://www.moviesnobs.net/images/box_11.gif\" width=\"5\" height=\"10\"></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
        <tr>
          <td><img src=\"http://www.moviesnobs.net/images/box_12.gif\" width=\"7\" height=\"100%\"></td>
          <td bgcolor=\"#FAFAFA\" width=\"186\" height=\"43\" valign=\"top\">
 <b>Movie Title:</b> 
$title<br><b>Director:</b> $director<br><b>Written by:</b> $writer<br> <b>Main Cast:</b> $main_cast<br><b>MPAA Rating:</b> 

$rating<br><b>Runtime:</b> $runtime<br> <b>Reviewed by: </b> $reviewed_by<br>
<B>Snob-Rating:</b><br><center><img src=\"http://www.moviesnobs.net/images/stars/
$stars.gif\" alt=\"Rating\"></center>
<hr width=\"100%\" size=\"1\" color=\"#B2B2B2\" noshade><br><b>Release Date:</b> 
$release_theater<br><b>DVD Release Date:</b> $release_dvd<br><img 

src=\"http://www.moviesnobs.net/images/sub_bullet.gif\" alt=\"\"> <a href=\"http://www.netflix.com/AddToQueue?movieid=
$netflix\" target=\"_blank\" 

onmouseover=\"window.status='';return true\" onmouseout=\"window.status='';return true\" target=\"_blank\" title=\"Add 
$title To Your Netflix Queue\">Netflix 

$title</a><Br><img src=\"http://www.moviesnobs.net/images/sub_bullet.gif\" alt=\"\"> <a href=\"$amazon\" title=\"Buy $title at Amazon.com\" target=\"_blank\" 

onmouseover=\"window.status='';return true\" onmouseout=\"window.status='';return true\">Buy 
$title at Amazon</a><img 

src=\"http://www.assoc-amazon.com/e/ir?t=moviesnobs-20&amp;l=ur2&amp;o=1\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; 

margin:0px !important;\" /><br>
             
          </td>
          <td><img src=\"http://www.moviesnobs.net/images/box_14.gif\" width=\"5\" height=\"100%\"></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src=\"http://www.moviesnobs.net/images/box_17.gif\" width=\"198\" height=\"8\"></td>
  </tr>
</table>
<!-- End Reviews Box Box --><? include('boxes/boxes.php') ?>
<p>&nbsp;</p></td>
<td width=\"785\" height=\"339\" valign=\"top\">

<table height=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\" width=\"768\"><tr>
<p>&nbsp;<br> <!-- Begin Body Here --> 



<center><span class=\"castlarge\">
$title</span><br>
Review written on 
$date_written<br><br><img src=\"http://www.moviesnobs.net/images/content/email_send.gif\" alt=\"\"> <a href=\"refer_a_review.php\" 

onmouseover=\"window.status='';return true\" onmouseout=\"window.status='';return true\" target=\"_blank\" title=\"Send this review to a friend!\">E-mail 

this review to a friend</a> <img src=\"http://www.moviesnobs.net/images/content/printer.gif\" alt=\"\"> <a href=\"print_view.php?movieid=
$movieid\" 

target=\"_blank\" title=\"Printable Version\">Printable View</a></center><Br>
<blockquote><blockquote><img src=\"http://www.moviesnobs.net/images/posters/
$poster\"  border=\"2\" align=\"right\" hspace=\"15\" vspace=\"5\" 

alt=\"
$page_title\">$review<p><B>See more reviews for the main cast of $title</b>: $main_cast</blockquote></blockquote>

      <!--End  Body -->
    </td></tr></table>
</td>
</tr>
</table>

<tr>
<td background=\"http://www.moviesnobs.net/images/bg_conbott.gif\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"28\"><img src=\"http://www.moviesnobs.net/images/bmenu_01.gif\" width=\"28\" height=\"37\"></td>
<td width=\"24\"><img src=\"http://www.moviesnobs.net/images/bmenu_02.gif\" width=\"24\" height=\"37\"></td>
<td width=\"22\"><img src=\"http://www.moviesnobs.net/images/bmenu_03.gif\" width=\"22\" height=\"37\"></td>
<td width=\"66\"><img src=\"http://www.moviesnobs.net/images/bmenu_04.gif\" width=\"66\" height=\"37\"></td>
<td width=\"75\"><img src=\"http://www.moviesnobs.net/images/dfs_12.gif\" width=\"75\" height=\"37\"></td>
<td width=\"788\" height=\"37\"></td>
</tr>
</table></td>
</tr>
<tr>
<td background=\"http://www.moviesnobs.net/images/bg_bottmenu.gif\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td><a href=\"http://www.moviesnobs.net/index.php\" onmouseover=\"on8();\" onmouseout=\"off8();\"><img 

src=\"http://www.moviesnobs.net/images/buttbs_home.gif\" width=\"28\" height=\"24\" border=\"0\" name=\"h\" onmouseover=\"window.status='Home Page';return 

true\" onmouseout=\"window.status='';return true\"></a></td>
<td><a href=\"javascript:history.back(1)\" onmouseover=\"on9();\" onmouseout=\"off9();\"><img src=\"http://www.moviesnobs.net/images/buttbs_back.gif\" 

width=\"24\" height=\"24\" border=\"0\" name=\"i\" onmouseover=\"window.status='Back A Page';return true\" onmouseout=\"window.status='';return 

true\"></a></td>
<td><a href=\"#top\" onmouseover=\"on10();\" onmouseout=\"off10();\"><img src=\"http://www.moviesnobs.net/images/buttbs_top.gif\" width=\"22\" height=\"24\" 

border=\"0\" name=\"j\" onmouseover=\"window.status='Top Of Page';return true\" onmouseout=\"window.status='';return true\"></a></td>
<td><img src=\"http://www.moviesnobs.net/images/bmenu_08.gif\" width=\"66\" height=\"24\" border=\"0\"></td>

</tr>
</tr>
</table></td>
</tr>
<tr>
<td background=\"http://www.moviesnobs.net/images/bg_footer.gif\" valign=\"top\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td><img src=\"http://www.moviesnobs.net/images/spacer.gif\" width=\"770\" height=\"40\"></td>
</tr>
</table></td>
</tr>
</table>
 <? include(\"footer.php\") ?>
</body>
</html>"
;

 
// put your existing code here to display the results 
    



echo 
"";
?>
The two includes (boxes/boxes.php) and (footer.php) don't work in the second "new" version of the code. But work flawlessly in the original. Any ideas?
Reply With Quote
  #2 (permalink)  
Old 07-02-06, 07:45 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You have to break the string.

PHP Code:

"</table></td>

</tr>
</table>"
;

include(
"footer.php");

echo 
"</body>
</html>"

Plus, if you use single quotes to echo a string, you won't have to escape the double quotes.
PHP Code:



echo '<meta NAME="description" CONTENT="Movie Snobs Movies Reviews by people who love movies">'
Plus plus, you won't have to escape anything if you break the <?php tags.

PHP Code:

<?php


// php code here

?>

<html>
<body>
HTML code here
</body>

<?php

// continue with PHP code.

?>

EDIT

And you can simplify this:
PHP Code:

while ($row mysql_fetch_array($result)){

$tags $row['tags'];
$stars $row['stars'];
$rating $row['rating'];
$main_cast $row['main_cast'];
$review $row['review'];
$runtime $row['runtime'];
$release_dvd $row['release_dvd'];
$release_theater $row['release_theater'];
$reviewed_by $row['reviewed_by'];
$links $row['links'];
$director $row['director'];
$writer $row['writer'];
$tags $row['tags'];
$poster $row['poster'];
$date_written $row['date_written'];
$page_title $row['page_title'];
$amazon $row['amazon'];
$netflix $row['netflix'];
$title $row['title'];

To this

PHP Code:

while ($row mysql_fetch_array($result)){


extract($row);


http://us2.php.net/manual/en/function.extract.php

Last edited by nico_swd; 07-02-06 at 07:49 AM.
Reply With Quote
  #3 (permalink)  
Old 07-02-06, 07:55 AM
mike_jandreau mike_jandreau is offline
Newbie Coder
 
Join Date: Jun 2006
Location: Boston
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Dude, you're my hero.

Thanks for the help. I knew there was something simple I was missing.

And for the tip on using single quotes. Escaping all the quotes was starting to bug the hell outta me.

Appreciate the help.
Reply With Quote
  #4 (permalink)  
Old 07-02-06, 07:59 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You have to keep i mind that variables won't be parsed between single quotes.

PHP Code:



$user 
'Mike';

echo 
'Hello $user';

// Prints: Hello $user 
You have to break the string

PHP Code:

$user 'Mike';


echo 
'Hello '$user .' rest of string....'
Reply With Quote
  #5 (permalink)  
Old 07-02-06, 08:13 AM
mike_jandreau mike_jandreau is offline
Newbie Coder
 
Join Date: Jun 2006
Location: Boston
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. That part I had learned from when I set up the search engine (for echoing the results page)

Looks like I'm on my way to a long day of recoding pages. But well worth it.

Thanks again for your help.
Reply With Quote
  #6 (permalink)  
Old 04-02-07, 09:52 PM
_net's Avatar
_net _net is offline
Newbie Coder
 
Join Date: Apr 2007
Location: Local Disk C:
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
here is a shortcut.
Instead of <? echo $page_title; ?> you can try
<?= $page_title; ?>

Reply With Quote
  #7 (permalink)  
Old 04-03-07, 05:02 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
Quote:
Originally Posted by _net View Post
here is a shortcut.
Instead of <? echo $page_title; ?> you can try
<?= $page_title; ?>

that will only work if short_open_tags is set to On
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP sockets - checking connection.. HELP!!! Turboz PHP 1 12-30-05 03:53 PM
Include PHP code... enchen PHP 2 09-22-05 07:20 AM
Include PHP via javascript bkbenson JavaScript 4 02-19-05 12:40 AM
Proven PHP Script not working on Windows 2000 server – any ideas? chimchim PHP 5 11-13-03 09:16 PM
problem in cookies @ phppro list vb2vb PHP 13 06-22-03 08:04 PM


All times are GMT -5. The time now is 07:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.