Jump to content

'mysqli' not found


KenM
 Share

Recommended Posts

New to PW and new to PHP, so sorry in advance!

I am trying to set up a database connection. I have a small test file in the web root (next to index.php), and if I point my browser at that I can connect to my database. If I take the same lines of php code and insert them into a template file that I want to use (asset-register.php), it gives me a fatal error with Class 'mysqli' not found in site/templates/asset-register.php:56

What am I missing?

I've attached the file, but it is currently just a hack file.. The end goal is to be able to print a report from a database, but I need to be able to connect first!

asset-register.php

Link to comment
Share on other sites

Scope?

When in the template file are you in Namespace\Processwire

Have you tried to call it with a backslash in front? new \mysqli ... ?

 

EDIT: Yes it is the missing backslash. (downloaded and looked into your php file) ?

Edited by horst
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...