unemployment Posted January 18, 2011 Share Posted January 18, 2011 I get a t-string error. Any thoughts? $emp = 'SELECT employees.function FROM employees WHERE employees.userid=${r['id']}'; Quote Link to comment https://forums.phpfreaks.com/topic/224801-t-string-error/ Share on other sites More sharing options...
DavidAM Posted January 18, 2011 Share Posted January 18, 2011 You are using single-quotes (around the array index "id") inside of a single-quote delimited string. The single-quote before "id" is ending your string, and the "id" is an unexpected string. Since you can't put a variable inside a single-quote delimited string, you need to delimit the string with double quotes: $emp = "SELECT employees.function FROM employees WHERE employees.userid=${r['id']}"; Quote Link to comment https://forums.phpfreaks.com/topic/224801-t-string-error/#findComment-1161167 Share on other sites More sharing options...
Pikachu2000 Posted January 18, 2011 Share Posted January 18, 2011 And move the $ inside the curly braces . . . {$r['id']} Quote Link to comment https://forums.phpfreaks.com/topic/224801-t-string-error/#findComment-1161174 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.