Lets say I want to use a php template and my current method is something like: Step 1: Set variables $titletag = "page title"; $h1tag = "welcome to my site"; $content = "blah blah blahdedy blah blah blah"; Step 2: Include a template with variables that are replaced <?php require_once('../template.php'); ?> This is all fine and good with simple content...But how do I do this if there are sql queries with lots of quotation marks in my $content? How can I make a big page full of sql queries and other word into the $content variable so that I can use it with my template? I had some success making other pages (like webforms) into $content because I could replace all of the " characters with '. However, sql queries seem to need " characters.
SQL queries don't need " actually. When specifying a string value in SQL, use single quotations. If you still need double quotations, simply escape it with \"
the queries are not in the template...they are above the template in the code. however lets say I want to create a variable $content if the variable $content has the sql queries in it and a lot of other information, it seems like it has to use " at some point... It's like having to include a whole page of content into the $content variable and not being able to use " anywhere as that would make the code badly formed and cause errors example: <?php $db = mysql_select_db($database,$connection) or die ("couldn't select database"); $query = "select * from table1 where state='$state'"; $result = mysql_query($query) or die ("couldn't do query"); ?> how could I make that into part of the variable $content ???
hmm, you aren't making much sense with this. From what I can gather however, you need to use the eval() function