Jump to content
Larry Ullman's Book Forums

Chaper 9. Mysqli_Connect.Php In Same Folder But Doesn'T Work?

Recommended Posts

Hello, I am currently in chapter 9 where I want to create a registration form (page 276) .


It tells me to add


require ('../mysqli_connect.php');


I tried putting mysqli_connect.php in a folder above the one that registration.php is in to fit the exact code in the book but it didn't work, then I tried putting it in the same folder and changing the code to


require ('mysqli_connect.php')



But when I try to register I get the error(s):



Warning: require(mysqli_connect.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\phptest\Chapter 9\register.php on line 52


Fatal error: require() [function.require]: Failed opening required 'mysqli_connect.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\phptest\Chapter 9\register.php on line 52



It's probably something really simple but I'm kind of lost, so help would be much appreciated!

Link to post
Share on other sites

I just tried this, i copied the ch09 folder into my the htdocs folder. The mysqli_connect.php script was already in the same location as register.php which calls for the script. I changed the

require ('../mysqli_connect.php') to require ('mysqli_connect.php') like you did and it worked fine.


So if you are using 2nd case, require ('mysqli_connect.php'), the mysqli_connect.php script must be in the same folder as register.php, otherwise put it below the folder, that would be the htdocs. I tried once before putting mysql connection folders below the htdocs root folder and i get the same errors you are receiving now.

  • Upvote 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...