Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question help me with this code??

    how can i place this code


    <a href="javascript:;" onClick="doAction('<?php echo $postid;?>','like');">Like (<span id="<?php echo $postid;?>_likes"><?php echo $data->like;?></span>)</a>
    <a href="javascript:;" onClick="doAction('<?php echo $postid;?>','unlike');">Unlike (<span id="<?php echo $postid;?>_unlikes"><?php echo $data->unlike;?></span>)</a>

    below this code


    $blabberDisplayList .= '
    <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC">
    <tr>
    <td width="10%" valign="top">' . $blab_pic . '</td>
    <td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' . $blab_date . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said:</span><br />
    ' . $the_blab . '</td>

    when i do it,it shows some error.

  • #2
    Regular Coder
    Join Date
    May 2011
    Posts
    124
    Thanks
    12
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by sssunny View Post
    how can i place this code


    <a href="javascript:;" onClick="doAction('<?php echo $postid;?>','like');">Like (<span id="<?php echo $postid;?>_likes"><?php echo $data->like;?></span>)</a>
    <a href="javascript:;" onClick="doAction('<?php echo $postid;?>','unlike');">Unlike (<span id="<?php echo $postid;?>_unlikes"><?php echo $data->unlike;?></span>)</a>

    below this code


    $blabberDisplayList .= '
    <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC">
    <tr>
    <td width="10%" valign="top">' . $blab_pic . '</td>
    <td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' . $blab_date . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said:</span><br />
    ' . $the_blab . '</td>

    when i do it,it shows some error.
    First, what's the error?

    Second, are you trying to open another set of php tags inside of an already opened PHP tag?

    Third, put spaces between the semi-colons and the question marks.

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts
    i was doing that in dreamweaver it dosen't tell..what's the error.

  • #4
    New Coder
    Join Date
    Jul 2012
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Parse error: syntax error, unexpected '?' in /home/a4961700/public_html/profile.php on line 229

  • #5
    Regular Coder
    Join Date
    May 2011
    Posts
    124
    Thanks
    12
    Thanked 6 Times in 6 Posts
    Can you post the whole files contents?

  • #6
    New Coder
    Join Date
    Jul 2012
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts
    if (isset($_SESSION['idx']))
    {
    $blabberDisplayList .= '
    <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC">
    <tr>
    <td width="10%" valign="top">' . $blab_pic . '</td>
    <td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' . $blab_date . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said:</span><br />
    ' . $the_blab . '</td>
    </tr><tr>
    <td valign="top" colspan="2">
    <div class="fb-comments" data-href="http://akhrot.com" data-num-posts="20" data-width="450"></div>
    </td>


    [this is the line 229]<a href="javascript:;" onClick="doAction(<?php echo $postid; ?>','like');">Like (<span id="<?php echo $postid; ?>_likes"><?php echo $data->like; ?></span>)</a>
    <a href="javascript:;" onClick="doAction('<?php echo $postid; ?>','unlike');">Unlike (<span id="<?php echo $postid; ?>_unlikes"><?php echo $data->unlike; ?></span>)</a>

    }

  • #7
    Regular Coder
    Join Date
    May 2011
    Posts
    124
    Thanks
    12
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by sssunny View Post
    if (isset($_SESSION['idx']))
    {
    $blabberDisplayList .= '
    <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC">
    <tr>
    <td width="10%" valign="top">' . $blab_pic . '</td>
    <td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' . $blab_date . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said:</span><br />
    ' . $the_blab . '</td>
    </tr><tr>
    <td valign="top" colspan="2">
    <div class="fb-comments" data-href="http://akhrot.com" data-num-posts="20" data-width="450"></div>
    </td>


    [this is the line 229]<a href="javascript:;" onClick="doAction(<?php echo $postid; ?>','like');">Like (<span id="<?php echo $postid; ?>_likes"><?php echo $data->like; ?></span>)</a>
    <a href="javascript:;" onClick="doAction('<?php echo $postid; ?>','unlike');">Unlike (<span id="<?php echo $postid; ?>_unlikes"><?php echo $data->unlike; ?></span>)</a>

    }
    Your PHP tags <?php ?> are still open from the first time when you try to open another set of php tags. You can't do that... you either have to close the previous tag, or combine all the php tags together.

    PHP Code:
    if (isset($_SESSION['idx'])){
                    
    $blabberDisplayList .= '
                        <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC">
                        <tr>
                        <td width="10%" valign="top">' 
    $blab_pic '</td>
                        <td width="90%" valign="top" style="line-height:1.5em;"><span class="greenColor textsize10">' 
    $blab_date ' <a href="profile.php?id=' $uid '">' $username '</a> said:</span><br />
                ' 
    $the_blab '</td>
    </tr><tr>
    <td valign="top" colspan="2">
    <div class="fb-comments" data-href="http://akhrot.com" data-num-posts="20" data-width="450"></div>
    </td>
    <a href="javascript:;" onClick="doAction(\''
    .$postid.'\',\'like\');">Like (<span id="'.$postid.'_likes">'.$data->like.'</span>)</a>
            <a href="javascript:;" onClick="doAction(\''
    .$postid.'\',\'unlike\');">Unlike (<span id="'.$postid.'_unlikes">'.data->unlike.</span>)</a>
        

    The PHP tags tell the PHP parser to read this and do what it reads. If you have an opening PHP tag, the parser starts reading, then it finds another opening tag, it doesn't see it as an opening tag because the parser is already reading.
    Last edited by HDRebel88; 07-21-2012 at 01:51 PM.

  • Users who have thanked HDRebel88 for this post:

    sssunny (07-21-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •