...

View Full Version : help me with this code??



sssunny
07-21-2012, 11:50 AM
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.

HDRebel88
07-21-2012, 11:57 AM
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.

sssunny
07-21-2012, 12:03 PM
i was doing that in dreamweaver it dosen't tell..what's the error.

sssunny
07-21-2012, 12:18 PM
Parse error: syntax error, unexpected '?' in /home/a4961700/public_html/profile.php on line 229

HDRebel88
07-21-2012, 12:32 PM
Can you post the whole files contents?

sssunny
07-21-2012, 12:38 PM
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>

}

HDRebel88
07-21-2012, 01:32 PM
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.



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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum