Jump to content


Photo

Php Synatx error


  • Please log in to reply
4 replies to this topic

#1 davemilan

davemilan

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 30 March 2013 - 12:46 AM

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

 



#2 timothyarden

timothyarden

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts

Posted 30 March 2013 - 12:58 AM

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


Edited by timothyarden, 30 March 2013 - 12:58 AM.


#3 davemilan

davemilan

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 30 March 2013 - 01:03 AM

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 ?


#4 timothyarden

timothyarden

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts

Posted 30 March 2013 - 06:37 PM

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 :)



#5 timothyarden

timothyarden

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts

Posted 05 April 2013 - 02:28 AM

Did this work?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com