Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

error message

Posted by bschultz (bschultz), 24 February 2003
I'm getting the following error message on a script.

Warning: main(testphp) [function.main]: failed to create stream: No such file or directory in c:\program files\apache group\apache\htdocs\sports\softball\statstest.php on line 17

Fatal error: main() [function.main]: Failed opening required 'testphp' (include_path='.;c:\php4\pear') in c:\program files\apache group\apache\htdocs\sports\softball\statstest.php on line 17

Here's the code:
Code:
<?php
require test.php?>

  <?php print$_POST['T1']?>;  size="27"
  <?php print$_POST['T2']?>;" size="13"
 

     <?php print$_POST['T3']?> size="13"
 
     <?php print$_POST['T4']?> size="4"
     
     <?php print$_POST['T5']?> size="4"
   
     <?php print$_POST['T6']?> size="4"
   
     <?php print$_POST['T7']?> size="4"
     
     <?php print$_POST['T8']?> size="4"
     
     <?php print$_POST['T9']?> size="4"
     
     <?php print$_POST['T10']?> size="4"
     
     <?php print$_POST['T11']?> size="4"
     
     <?php print$_POST['T12']?> size="4"  


Here is code for stats.php:

Code:
<?php
$filename = 'test.php';
$somecontent = "$_POST[$T1], $_POST[T2], $_POST[T3], $_POST[T4], $_POST[T5]";

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

   // In our example we're opening $filename in append mode.
   // The file pointer is at the bottom of the file hence
   // that's where $somecontent will go when we fwrite() it.
   if (!$fp = fopen($filename, 'a')) {
        print "Cannot open file ($filename)";
        exit;
   }

   // Write $somecontent to our opened file.
   if (!fwrite($fp, $somecontent)) {
       print "Cannot write to file ($filename)";
       exit;
   }
   
   print "Success, wrote ($somecontent) to file ($filename)";
   
   fclose($fp);
                             
} else {
   print "The file $filename is not writable";
}
?>


Any ideas?

Posted by admin (Graham Ellis), 25 February 2003
Is the first file called "statstest.php" and have you supplied a sample starting at line 17?

I think that
     require test.php
should read
     require "test.php"

Note the extra quotes.  The "." without the quotes is a string concatanation operator, thius making up a file name testphp (note no . in the name) which couldn't be found ....

Posted by bschultz (bschultz), 25 February 2003
That was it, Thanks Graham.

Thanks!  Thought it had to be something simple.

Brian



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho