Jump to content

T_ENDIF error.. going crazy.


nicoscodes

Recommended Posts

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 by nicoscodes
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"); ?>

 

Link to comment
Share on other sites

the combined code you have posted does not produce the error you have implied. try again :psychic:

 

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.

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.