Question: I am pretty new at php, quick note this is an android application that i am calling this script, I am not having the users make up the script lol. There is a series of checkboxs and when they check off certain ones it appends a script to the string builder. i am trying to run a query based on the value of a variable that is being passed in. Usually i do something like this,

```
   mssql_query("UPDATE Userdata SET BrowseScript = '".$_REQUEST['sqlscript']."' 
WHERE Userdata.Username = '".$_REQUEST['Username']."'");

```

and where it says .`$_REQUEST['']` I can grab values that i pass in. 

But this time the `.$_REQUEST['']` is the whole script, so i want something like this

```
mssql_query($_REQUEST['sqlscript']);

```

and thats it i want it to run the query thats in that value, The query is correct, but it just will not return any value, I think i may have some type of syntax error or something, like i said i am new to php. Thanks for any help. Also I am not posting the whole code because everything is running ok, i just cant get that query to run. so all i need assistance with is the mssql\_query part thanks again.

Answer: 
Split your templates into control/data preparation logic and 'views' that do the output rendering.

Set up the data you need first and then write the output with the most minimal logic possible.

If you can parcel up the output into reusable chunks, then you can put those in method wrappers in <#+ #> blocks and do the structural work as a set of method calls.
Use a third party formatting tool to Format your code after generation like Teleriks Just Code