12 Replies - 665 Views - Last Post: 21 July 2012 - 04:54 AM Rate Topic: -----

#1 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

help me with this code?

Posted 21 July 2012 - 03:58 AM

<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.

This post has been edited by RudiVisser: 21 July 2012 - 03:58 AM
Reason for edit:: code tags


Is This A Good Question/Topic? 0
  • +

Replies To: help me with this code?

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: help me with this code?

Posted 21 July 2012 - 03:58 AM

What error?

What have you tried to do to fix it?
Was This Post Helpful? 0
  • +
  • -

#3 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

Re: help me with this code?

Posted 21 July 2012 - 03:59 AM

some syntax error
Was This Post Helpful? -3
  • +
  • -

#4 Slice  Icon User is online

  • sudo pacman -S moneyz


Reputation: 241
  • View blog
  • Posts: 700
  • Joined: 24-November 08

Re: help me with this code?

Posted 21 July 2012 - 04:00 AM

The actual error itself would be helpful.
Was This Post Helpful? 0
  • +
  • -

#5 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

Re: help me with this code?

Posted 21 July 2012 - 04:03 AM

i was doing that in dreamweaver it dosen't tell..what's the error.
Was This Post Helpful? -1
  • +
  • -

#6 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

Re: help me with this code?

Posted 21 July 2012 - 04:09 AM

there is a syntax error in line 245.code hinting may not work until you fix this.
Was This Post Helpful? -1
  • +
  • -

#7 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: help me with this code?

Posted 21 July 2012 - 04:10 AM

So execute the code and get the error.

If you don't know what you're doing with PHP or even basic debugging regarding it; why are you using it?

(I really want to close this thread but it's too much fun)

This post has been edited by RudiVisser: 21 July 2012 - 04:11 AM

Was This Post Helpful? 0
  • +
  • -

#8 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

Re: help me with this code?

Posted 21 July 2012 - 04:16 AM

Parse error: syntax error, unexpected '?' in /home/a4961700/public_html/profile.php on line 229
Was This Post Helpful? 0
  • +
  • -

#9 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: help me with this code?

Posted 21 July 2012 - 04:17 AM

Yay and what is line 229?

What do you think it could be that's causing the error..?
Was This Post Helpful? 0
  • +
  • -

#10 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: help me with this code?

Posted 21 July 2012 - 04:18 AM

And give the lines before and after 229 as well.
Was This Post Helpful? 0
  • +
  • -

#11 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

Re: help me with this code?

Posted 21 July 2012 - 04:24 AM

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>

This post has been edited by Atli: 21 July 2012 - 04:32 AM
Reason for edit:: Added [code] tags.

Was This Post Helpful? 0
  • +
  • -

#12 ssssunny  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 10
  • Joined: 17-July 12

Re: help me with this code?

Posted 21 July 2012 - 04:39 AM

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>

}

Was This Post Helpful? 0
  • +
  • -

#13 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,964
  • Joined: 08-June 10

Re: help me with this code?

Posted 21 July 2012 - 04:54 AM

So that entire thing is one big, ugly string? No wonder you're getting syntax errors...

The problem is that you are creating a big, ugly, single-quote delimited string, but on the line it's complaining about you try to use a single-quote in the Javascript code inside the single-quote string. Naturally, PHP can't tell whether that quote is meant to close the big-ugly string, or whether it's supposed to be inside the big-ugly string. So it's only choice is to go with the former and slam a syntax error on you.

The best solution for this problem is Code-Separation. Master that and problems like these will never happen. - The worse solution is to fix the string so that the quote marks match up. If you have to use a single-quote inside a single quoted string, escape it:
// INVALID
$str = 'It's invalid!';

// Valid
$str = 'It\'s valid!';


Was This Post Helpful? 3
  • +
  • -

Page 1 of 1