0

Custom variables that are in a custom global.php file are not being passed to a homepage.php, I have set up as the static homepage for WordPress. It just gives null errors as if the variable doesn't exist. Is it something that wordpress is doing? Should I have the database connection variable in a the function.php file?

Error: Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/test/homepage-file.php line

Anyone have any ideas?

custom-global.php:
<?php
$db = mysqli_connect(xxx);
?>


homepage-file.php:
<?php
require_once("custom-global.php");
mysqli_query($db, "XXX");
?>
  • Not without seeing the code. It could literally be anything. – jdm2112 Dec 15 '17 at 17:15
  • What does this have to do with WordPress? – Jacob Peattie Dec 16 '17 at 4:25
  • Jacob, I'm trying to get a custom .php homepage to load with wordpress. Using the custom .php homepage as a static web page. – CarlLikesBowling Jan 2 '18 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.