Jump to content

Archived

This topic is now archived and is closed to further replies.

davemilan

Php Synatx error

Recommended Posts

Hello everybody,

 

I am new to this community as well as PHP and cakePHP.

 

Currently I am working on a script, however it results in a syntax error and I can't figure out how to get this resolved.

 

The line in question is this one:

 

<?php echo $this->Html->link('View/Edit', array('action' => 'view', $client['Client']['id']), "?" => array('nc' => time(), array('class' => 'view')); ?>
 

It would be greatly appreciated if someone can let me know how to resolve this.

 

Thank you very much, 

DM

 

Share this post


Link to post
Share on other sites

Not 100% sure but (highlighted text)

<?php echo $this->Html->link('View/Edit', array('action' => 'view', $client['Client']['id']), "?" => array('nc' => time(), array('class' => 'view')); ?>

 

I think should have a key

Try and see

Share this post


Link to post
Share on other sites

Thank you very much for your reply timothyarden,

 

the error I get with my code is:

 

 

Parse error: syntax error, unexpected T_DOUBLE_ARROW on line 1
 
Any idea how I can change this around ?

Share this post


Link to post
Share on other sites

Hi Dave,

You were missing a parenthesis:

To check your code for the error I just spaced it out - below is the code with an error followed by the code without the error

echo $this -> Html -> link(
		'View/Edit', 
		array(
			'action' => 'view', 
			$client['Client']['id']
		), 
		"?" => array(
			'nc' => time(), 
			array(
				'class' => 'view'
			)
		); 
echo $this -> Html -> link(
		'View/Edit', 
		array(
			'action' => 'view', 
			$client['Client']['id']
		), 
		"?" => array(
			'nc' => time(), 
			array(
				'class' => 'view'
			)
		)
	); 

 

 

 

 

Hope this helps :)

Share this post


Link to post
Share on other sites

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