[Help me] syntax error - T_STRING

Discussion in 'PHP' started by dnsman, Feb 18, 2010.

  1. #1
    Parse error: syntax error, unexpected T_STRING in /home/design/testscripts/v0tes/index.php on line 19


     $row = mysql_fetch_array(mysql_query("SELECT `yes`,`no` FROM `votes` WHERE `id` = '$id'"));
        $yess = (empty($row['yes'])) ? 0 : $row['yes'];
        $noo = (empty($row['no'])) ? 0 : $row['no'];
    
    [COLOR="Red"]    $timestamp_vote = (is_numeric(TIMESTAMP_VOTE) && TIMESTAMP_VOTE > 0) ? time() – (TIMESTAMP_VOTE * 3600) : 0;[/COLOR]
    
        $query = mysql_query("SELECT `vote` FROM `ips` WHERE `id` = '$id' AND `ip` = '".$_SERVER['REMOTE_ADDR']."' AND `timestamp` > '$timestamp_vote' LIMIT 1");
    Code (markup):
    Where is the error?
     
    dnsman, Feb 18, 2010 IP
  2. chessh

    chessh Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Show us the whole file, or at least specify which is line 19.
     
    chessh, Feb 18, 2010 IP
  3. dnsman

    dnsman Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>&&</title>
        <?php $id = (is_numeric($_GET['id']) && $_GET['id'] > 0) ? $_GET['id'] : 0; ?>
        <script type="text/javascript" src="vote.js"></script>
        <script language="JavaScript">
        function movepic(img_name,img_src) {
        document[img_name].src=img_src;
        }
        </script>
        </head>
        <?php
        require "connect.php";
        $row = mysql_fetch_array(mysql_query("SELECT `yes`,`no` FROM `votes` WHERE `id` = '$id'"));
        $yess = (empty($row['yes'])) ? 0 : $row['yes'];
        $noo = (empty($row['no'])) ? 0 : $row['no'];
    
        $timestamp_vote = (is_numeric(TIMESTAMP_VOTE) && TIMESTAMP_VOTE > 0) ? time() – (TIMESTAMP_VOTE * 3600) : 0;
    
        $query = mysql_query("SELECT `vote` FROM `ips` WHERE `id` = '$id' AND `ip` = '".$_SERVER['REMOTE_ADDR']."' AND `timestamp` > '$timestamp_vote' LIMIT 1");
        $vote_ip = mysql_fetch_object($query);
        $vote_yes = (($vote_ip -> vote) == 1) ? "vote_up" : "vote_up2";
        $vote_no = (($vote_ip -> vote) == -1) ? "vote_down" : "vote_down2";
    
        $procent_yes = @round(($yess / ($yess + $noo)) * 100);
        $procent_no = @round(($noo / ($yess + $noo)) * 100);
        ?>
        <body>
    
        <div id="txtHint"><?php if (!mysql_num_rows($query)) { ?><a href="javascript:void(null)" onclick="showHint('1','<?=$id?>')" onmouseover="movepic('pic1','vote_up.gif');"
        onmouseout="movepic('pic1','vote_up2.gif');"><? } ?><img name="pic1" src="<?=$vote_yes?>.gif" border="0"><?php if (!mysql_num_rows($query)) { ?></a><? } ?> <b><?=$yess?> (<?=$procent_yes?>%)</b>
        <?php if (!mysql_num_rows($query)) { ?><a href="javascript:void(null)" onclick="showHint('-1','<?=$id?>')" onmouseover="movepic('pic2','vote_down.gif');"
        onmouseout="movepic('pic2','vote_down2.gif');"><? } ?><img name="pic2" src="<?=$vote_no?>.gif" border="0"><?php if (!mysql_num_rows($query)) { ?></a><? } ?> <b><?=$noo?> (<?=$procent_no?>%)</b><br />
        All voted: <b><?=($yess+$noo)?></b></div>
    
        </body>
        </html>
    PHP:
     
    dnsman, Feb 18, 2010 IP
  4. emed

    emed Peon

    Messages:
    70
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    looks like the "minus" is causing the problem, just delete it and type it again.

    $timestamp_vote = (is_numeric(TIMESTAMP_VOTE) && TIMESTAMP_VOTE > 0) ? time() – (TIMESTAMP_VOTE * 3600) : 0;

    - normal minus
    – the symbol you have
     
    emed, Feb 18, 2010 IP
  5. dnsman

    dnsman Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    okay thanks-=)
     
    dnsman, Feb 19, 2010 IP