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
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho