nicoscodes Posted June 11, 2013 Share Posted June 11, 2013 (edited) Hey guys, have a bit of a strange situation going on here. Locally (through mamp) the website loads fine (perfectly actually) and I find zero errors, however going live I face the infamous T_ENDIF error according to my error log. I had the code working remotely however made some changes to only the HTML, uploaded and like as if it was black magic I was faced with the error.I proceeded to trouble shoot and I had the document which was orginally working before I edited the HTML and uploaded that and it worked perfectly, I then took the working document and in my editor hit the space bar, again black magic the working document then gave the same error, I hit cmd+z to undo the spacebar, re-uploaded and still had zero luck. Is it just me or am I going insane? Here is my code: <?php if($post = $_GET["id"]) { echo "<div class='engage-search-result'>Search Result:</div>"; $q = "SELECT * FROM questions WHERE id = '$post'"; $r = mysql_query($q); if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): $net_vote = $row['votes_up'] - $row['votes_down']; ?> <div class='entry'> <div class='q_container'> <div class='left'> <a href='javascript:;' class='vote_up' id='<?php echo $row['id']; ?>'>Up</a> <span class='votes_count' id='votes_count<?php echo $row['id']; ?>'> <?php echo $net_vote.""; ?> </span> <a href='javascript:;' class='vote_down' id='<?php echo $row['id']; ?>'>Down</a> </div><!--// left--> <div class='right'> <span class='link'> <?php echo "<a href='engage.php?id=".$row['id']."'>".$row['question']."</a>"; ?><br><?php echo $row['categorey']; ?> <br><br> <?php echo "<div class='fb-comments' data-href='http://sitehere.com' data-num-posts='2'></div>"; ?> </span><!--// link (span)--> </div><!--// right--> </div><!--// q_container--> </div><!--// entry--> <?php endwhile; endif; ?> <?php } else { $q = "SELECT * FROM questions WHERE verified = 'y'"; $r = mysql_query($q); if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): $net_vote = $row['votes_up'] - $row['votes_down']; ?> <div class='entry'> <div class="q_container"> <div class='left'> <a href='javascript:;' class='vote_up' id='<?php echo $row['id']; ?>'>Up</a> <span class='votes_count' id='votes_count<?php echo $row['id']; ?>'> <?php echo $net_vote.""; ?> </span> <a href='javascript:;' class='vote_down' id='<?php echo $row['id']; ?>'>Down</a> </div><!--// left--> <div class='right'> <span class='link'> <?php echo "<a href='engage.php?id=".$row['id']."'>".$row['question']."</a>"; ?><br>#<?php echo $row['categorey']; ?> </a> <br><br> <?php echo "<div class='fb-comments' data-href='http://www.sitehere.com/engage.php?id=".$row['id']."' data-num-posts='1'></div>"; ?> </span><!--// link (span)--> </div><!--// right--> </div><!--// q_container--> </div><!--// entry--> <?php endwhile; endif; } ?> I call my DB connection at the top of the browser using include, the error log shows the error on line 1 where my DB connection is held. I am only a begginer with PHP and I am aware I am not using PDO.Any help would be greatly appreciated. Edited June 11, 2013 by nicoscodes Quote Link to comment Share on other sites More sharing options...
NiTx Posted June 11, 2013 Share Posted June 11, 2013 $q = "SELECT * FROM questions WHERE id = '$post'"; should be $q = "SELECT * FROM questions WHERE id = {$post}"; Quote Link to comment Share on other sites More sharing options...
nicoscodes Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) No luck there, still getting the PHP Parse error: syntax error, unexpected T_ENDIF error. Edited June 11, 2013 by nicoscodes Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 11, 2013 Share Posted June 11, 2013 FATAL ERROR: unsupported old-style syntax. Please use {...} instead. if(mysql_num_rows($r)>0): to: if(mysql_num_rows($r)>0){} Quote Link to comment Share on other sites More sharing options...
nicoscodes Posted June 11, 2013 Author Share Posted June 11, 2013 Would this require me to change both: if(mysql_num_rows($r)>0): while($row = mysql_fetch_assoc($r)): As I mentioned I am a begginer, how would i properly execute this fix? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted June 11, 2013 Share Posted June 11, 2013 I call my DB connection at the top of the browser using include, the error log shows the error on line 1 where my DB connection is held. so, the posted code isn't the code that produces the error. the part you didn't post is what is producing the error. the posted code doesn't produce that error on the latest php5.4 version. you need to post the actual code that produces the error and posting the actual file name and line number from the error message would help those trying to help you. Quote Link to comment Share on other sites More sharing options...
nicoscodes Posted June 11, 2013 Author Share Posted June 11, 2013 so, the posted code isn't the code that produces the error. the part you didn't post is what is producing the error. the posted code doesn't produce that error on the latest php5.4 version. you need to post the actual code that produces the error and posting the actual file name and line number from the error message would help those trying to help you. I just didn't think it would be required as it is only the connection, but here is line 1 <?php include("include/conn.php"); ?> Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted June 11, 2013 Share Posted June 11, 2013 the combined code you have posted does not produce the error you have implied. try again i didn't ask for the filename and line number from the error message because i needed the typing practice. you have missread or misinterpreted the information that you saw in front of you we cannot help you based on the information you have provided. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 15, 2013 Share Posted June 15, 2013 (edited) if anyone can spot the error let us know. the engage script is not loading. outside of the local server enviroment. http://naturalnaring.com/engage.php Edited June 15, 2013 by darkfreaks Quote Link to comment 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.