Current location: Hot Scripts Forums » Programming Languages » PHP » help, t_string error.


help, t_string error.

Reply
  #1 (permalink)  
Old 11-27-04, 09:53 AM
jasperma jasperma is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
help, t_string error.

PHP Code:

<?php


function create_template($name$content) {
   if (
file_exists("$DOCUMENT_ROOT/templates/".$name.".txt"))
       {
         echo 
"The name you have chosen for this template already exists, please choose another name for your template. Click back and try again.";
         exit;
       } else {
         
$fpfopen("$DOCUMENT_ROOT/templates/".$name.", "w");
         fwrite(
$fp$content);
         fclose(
$fp);
       }
};
function create_template(apple, <p>test);
?>

Parse error: parse error, unexpected T_STRING in /home/imgvault/public_html/test.php on line 21


what's wrong?
Reply With Quote
  #2 (permalink)  
Old 11-27-04, 10:13 AM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
function create_template(apple, <p>test);
TO
function create_template('apple, <p>test');

$fp= fopen("$DOCUMENT_ROOT/templates/".$name.", "w");
to
$fp= fopen($DOCUMENT_ROOT . '/templates/' . $name, 'w');


if (file_exists("$DOCUMENT_ROOT/templates/".$name.".txt"))
to
if (file_exists($DOCUMENT_ROOT . '/templates/' . $name . '.txt'))
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Reply With Quote
  #3 (permalink)  
Old 11-27-04, 10:22 AM
jasperma jasperma is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
thanks, that worked.
Reply With Quote
  #4 (permalink)  
Old 11-27-04, 10:26 AM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
No problem :-)
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom error handling.. Acecool PHP 2 05-05-05 11:45 AM
on cgi/Perl module:- HTML MASON error executing script notepad_coder Perl 14 09-27-04 11:51 PM
You have an error in your SQL syntax. Help! SevEre PHP 7 09-08-04 05:05 AM
parse error... help? kappler0 PHP 2 01-21-04 03:57 AM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 08:12 PM


All times are GMT -5. The time now is 05:17 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.