php - Can not figure outsyntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING -


i querying database , recordid int. have line of code when echo out value of $content['recordid'] prints out numeric value, when put in here error:

syntax error, unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string.

but if replace $content['recordid'] numeric value works properly

$sqlcommentamount = "select * `info` `recordid` = $content['recordid']"; 

leave out '' within []

... $content[recordid]"; 

see documentation example #8: http://php.net/manual/en/language.types.string.php#language.types.string.parsing.simple

example #8 simple syntax example

<?php $juices = array("apple", "orange", "koolaid1" => "purple");  echo "he drank $juices[0] juice.".php_eol; echo "he drank $juices[1] juice.".php_eol; echo "he drank juice made of $juice[0]s.".php_eol; // won't work echo "he drank $juices[koolaid1] juice.".php_eol; (...) 

the above example output:

he drank apple juice. drank orange juice. drank juice made of s. drank purple juice. (...)      more complex, should use complex syntax. 

Comments

Popular posts from this blog

Using 'OR' and 'AND' in SQL Server -

c++ - NetBeans Remote Development with additional configuration -

visual studio - TFS will not accept changes I've made to a Java project -