Jump to content

help with something i cant figure out


dadamssg

Recommended Posts

I have coded a page that works perfectly. I go in and out of php coding throughout the page but when i try to write some php code into a new area i get this

 

Parse error: syntax error, unexpected T_VARIABLE in /home/inaggie1/public_html/look/indexx.php on line 59

 

line 59 contains ONLY the closing head tag and i'm inserting code well after line 59.

 

this is the php code i have at the very beginning of the page

<?php 
session_start(); 
include("caneck.inc"); 
include("logfunc.php"); 
include("header.php");
$_SESSION['goto'] = "index.php";

function snippet($text,$length=240,$tail="...") {
    $text = trim($text);
    $txtl = strlen($text);
    if($txtl > $length) {
        for($i=1;$text[$length-$i]!=" ";$i++) {
            if($i == $length) {
                return substr($text,0,$length) . $tail;
            }
        }
        $text = substr($text,0,$length-$i+1) . $tail;
    }
    return $text;
}


?>

 

but i don't know whats its throwing an error way in the beginning when im tryin to insert php way after that...ANY ideas?

 

Link to comment
Share on other sites

<?php 
session_start(); 
include("caneck.inc"); 
include("logfunc.php"); 
include("header.php");
$_SESSION['goto'] = "index.php";

function snippet($text,$length=240,$tail="...") {
    $text = trim($text);
    $txtl = strlen($text);
    if($txtl > $length) {
        for($i=1;$text[$length-$i]!=" ";$i++) {
            if($i == $length) {
                return substr($text,0,$length) . $tail;
            }
        }
        $text = substr($text,0,$length-$i+1) . $tail;
    }
    return $text;
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Home</title>
<link rel="stylesheet" type="text/css" href="sil.css" />
<script type="text/javascript">
function toggleField(el,isBlur){
   origValue = el.value;
if(el.id == el.value){
      el.value = '';
   } else {
      el.value = origValue;
   }
   if(el.value == '' && isBlur){
      el.value = el.id;
   }
}
</script>
<script type="text/javascript">
function open_win() 
{
window.open("http://www.twitter.com/inaggieland");
}
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-9432584-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</head>
<body>
   <div id="wrapper">


   <div id="vert"></div>


       <!-- Begin Header -->


        <?php head(); ?>


	 <!-- End Header -->


 <?php 


	 if(!isset($_GET['currentpage']))


	 {


	 echo "<div id='twitter' onclick='open_win()' style='cursor:pointer;'  ></div>	 





<div id='postevent'>


<div id='psevent'>


What's the Point?


</div>


As a resident of Aggieland, it's not always easy 


to know what's going on in town. We're forced to rely


on everything from radio and scribblings on blackboards,


to those annoying square fliers. I vote we consolidate 


our knowledge of all the happenings in town in one place...


right here. Let's work together to Beat the Hell Outta Boredom!


</div>";


   }else{
   echo "<div id='leaderboard'><script type='text/javascript'><!--
google_ad_client = 'pub-9776196630088334';
/* 728x90, created 9/11/09 */
google_ad_slot = '5368321103';
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script></div>";
   }


	 ?>





	<div id="topw"><div id="lpart"></div><div id="fmiddle">





</div><div id="rpart"></div></div>


	 <div id="content1">


	 <div id="rcolumn">


	 <div id='adver' onclick="location.href='postform.php';" style="cursor:pointer;"></div>
<?php
$cxn = mysqli_connect($host,$user,$passwd,$dbname) or die("Couldn't connect");
$sqv = "select * from poll_questions order by desc limit 1";
$resultv = mysqli_query($cxn,$sqv)
          or die (mysqli_error($result)); 
$row = mysqli_fetch_assoc($resultv);
?>
	 </div>


	<div id="leftcolumn"><div id="master">All Events</div>

 

the last piece of php code is what hangs it up. If i delete this section

<?php
$cxn = mysqli_connect($host,$user,$passwd,$dbname) or die("Couldn't connect");
$sqv = "select * from poll_questions order by desc limit 1";
$resultv = mysqli_query($cxn,$sqv)
          or die (mysqli_error($result)); 
$row = mysqli_fetch_assoc($resultv);
?>

 

it works perfect....but if i add it it throws that error way back on line 59

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.