PHP nesting quotes

The following fails:

$result = mysql_query("SELECT * FROM Tasks WHERE UserID = '$_SESSION['userID']'");

I tried the following:

$userID = $_SESSION['userID'];
$result = mysql_query("SELECT * FROM Tasks WHERE UserID = '$userID'");

and it works. Is there a way to do this without making a separate variable?

Thanks!

Answers


Or like this:

$result = mysql_query("SELECT * FROM Tasks WHERE UserID = '{$_SESSION['userID']}'");

Need Your Help

using iojs express and fluent-ffmpeg

node.js express ffmpeg io.js

i am trying to create a simple io.js that will read an opus file, convert it to mp3, and pass it to a webpage using express. here is what i have tried so far:

jquery autocomplete source as a url that takes in query strings

c# jquery jquery-autocomplete

I am trying to use the jQuery Autocomplete UI widget on a text box and I am having no luck getting the source to work. I have a database full of names that I want the autocomplete to work against,...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.