Search the Community
Showing results for tags 'quotes'.
Hi. I'm modifying the 'quotes' script in chapter 13 to include a statement before the quotes that indicates a 'new' or 'recent' quote if the quote was entered within the last 30 days. I know I need to use $row[date_entered] (type timestamp in mysql, e.g. 2014-03-09 13:25:11). Is there a function to compare that timestamp with today (in number of days)? Thanks.
This statement works fine as it is echo '<p>'.$query_row['name'].'</p>'; But how would it be possible to turn '<p>'.$query_row['name'].'</p>' into a variable that could be called back by a print or echo statement ? A not working example $myvar = '<p>'.$query_row['name'].'</p>'; echo $myvar; Does anyone know how this is possible?
Hello Forum - hello Larry - - I'm working on a Mac, OS X Version 10.5.8. When I write a quote that contains an apostrophe to quotes.txt file, for example -- I've wasted my hours. - Leonardo da Vinci -- somehow a backslash appears before the apostrophe in the text file, and the same quote inside quotes.txt looks like this: I\'ve wasted my hours. - Leonardo da Vinci When I get the same quote from the text file via php back to the browser in view_quote.php, the backslash is displayed. The backslash also appears before double quotes: \"I've wasted my hours.\" - Leonardo da Vinci Why do backslashes appear, and what can I do to remove them? Thank you! - Dimitri Vorontzov
Yup, already ran into trouble. Page Chapter 2, Page 46,47 Here's my script: <?php // Script 2.4 - quotes.php //single or double quotation marks won't matter here: $first_name = 'Saige'; $last_name = "The Powerful"; //single or double quotation marks DOES matter here: $name1 '$first_name $last_name'; <----- Line 16 $name2 "$first_name $last_name"; //single or double quotation marks DOES matter here: print "<h1>Double Quotes</h1> <p>name1 is $name1 <br /> name2 is $name2</p>"; print '<h1>Single Quotes</h1> <p>name1 is $name1 <br /> name2 is $name2 </p>' ?> Here's my error message: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /quotes.php on line 16