1

I am attempting to include a PHP file that contains a class that I would like to use. My main file includes:

<?php
    echo "main started"
    require_once("mysqli.php");
    echo "File Included";
?>

mysqli.php (which is located in the same folder as the main file):

<?php
    echo "Mysqli_connector"
    class Mysqli_connector {

} // end of class
?>

I output main started and then the program ends with no errors or warnings that I can see. Is there a problem with include files with classes in PHP? I am a C++ coder 95% of the time, so I'm not used to PHP querks.

cHao
  • 84,970
  • 20
  • 145
  • 172
user2761933
  • 179
  • 1
  • 4
  • 15
  • 1
    If you'd said `error_reporting(E_ALL); ini_set('display_errors', true);` before the `require_once`, you'd almost certainly see a message about a parse error. Reason #184 why you should have error reporting cranked up on your dev server. – cHao Jan 08 '14 at 19:55
  • Please don't correct the code you're asking about...doing so invalidates the answer. If you want to mention what you've fixed, add an updated version or describe the changes. (But the answers will already say what to change, so even that shouldn't be necessary.) – cHao Jan 08 '14 at 20:01

1 Answers1

9
echo "Mysqli_connector" // <-- missing closing semi-colon

You're also going to want to make sure you have display errors on and set to show all errors.

Community
  • 1
  • 1
John Conde
  • 217,595
  • 99
  • 455
  • 496