dadamssg Posted January 2, 2010 Share Posted January 2, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/186886-help-with-something-i-cant-figure-out/ Share on other sites More sharing options...
trq Posted January 2, 2010 Share Posted January 2, 2010 We would need to see the relevant code. eg; A little prior too and a little after line 59. Quote Link to comment https://forums.phpfreaks.com/topic/186886-help-with-something-i-cant-figure-out/#findComment-986928 Share on other sites More sharing options...
dadamssg Posted January 2, 2010 Author Share Posted January 2, 2010 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/186886-help-with-something-i-cant-figure-out/#findComment-986930 Share on other sites More sharing options...
Stephen Posted January 2, 2010 Share Posted January 2, 2010 I'm thinking it's this line: $resultv = mysqli_query($cxn,$sqv) or die (mysqli_error($result)); Try changing it to: $resultv = mysqli_query($cxn,$sqv) or die (mysqli_error($cxn)); Quote Link to comment https://forums.phpfreaks.com/topic/186886-help-with-something-i-cant-figure-out/#findComment-986932 Share on other sites More sharing options...
dadamssg Posted January 2, 2010 Author Share Posted January 2, 2010 thanks for the response but nope. just tried that and same thing.... Quote Link to comment https://forums.phpfreaks.com/topic/186886-help-with-something-i-cant-figure-out/#findComment-986933 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.