Jump to content

Search the Community

Showing results for tags 'heredoc'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I have a php file that has this in it... //Make logChatInput.php $dataBase = "users"; $logChatInput = fopen($newDir."/logChatInput.php", "w"); $logChatInput_contents = <<<EOD <?php $chatInput = addslashes($_GET["chatInput"]); date_default_timezone_set('America/Chicago'); $time = date('g:i A'); $crappychat_service = mysql_connect("localhost", "root", ""); mysql_select_db("{$dataBase}", $crappychat_service); $sql = "INSERT INTO messages (Message) VALUES('".$chatInput."')"; mysql_query($sql, $crappychat_service); ?> EOD; fwrite($logChatInput, $logChatInput_contents); fclose($logChatInput); My problem is I want ONLY $dataBase to be recognized as a the value it holds and not anything else. The php is giving an error because I don't have $chatInput declared outside the EOD. I only want the $dataBase variable to be associated with the current PHP file and not the one being written, so I put it in curly braces, but it still recognizes other "variables". How would have it only recognize $dataBase in the EOD?
  2. Having a parse error with my heredoc statement , so what is wrong with it ??? //retrieve information $query = 'SELECT movie_name, movie_year, movie_director, movie_leadactor, movie_type FROM movie ORDER BY movie_name ASC, movie_year DESC'; $result = mysql_query($query, $db) or die(mysql_error($db)); //determine the no. of rows in returned result $num_movies = mysql_num_rows($result); $table = <<<ENDHTML <div style="text-align: center" > <h2> Movie Review Database </h2> <table border="1" cellpadding="2" cellspacing="2" style="width: 70%; margin-left: auto; margin-right: auto;"> <tr> <th>Movie Title</th> <th>Year of release</th> <th>Movie Director</th> <th>Movie Lead Actor</th> <th>Movie Type</th> </tr> ENDHTML; // loop through the result while ($row = mysql_fetch_assoc($result)) { extract($row); $table .= <<<ENDHTML <tr> <td>$movie_name</td> <td>$movie_year</td> <td>$movie_director</td> <td>$movie_leadactor</td> <td>$movie_type</td> </tr> ENDHTML; } $table .= <<<ENDHTML </table> </div> <p align="center" >$num_movies Movies </p> </div> ENDHTML; echo $table; parse error : 'Parse error: syntax error, unexpected T_SL in table.php on line 22'
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.