Alright, when I compile this bit of code to test:
<?php
require('index.inc');
$page = new buildpage();
$page->buildHeader();
$dbase = $mysqli_connect('localhost', 'root', 'password');
<?php
$page->buildFooter();
?>
I'm getting:
PHP Notice: Undefined variable: mysqli_connect in
/home/tim/Doc开发者_如何学运维uments/Web/index2.php on line 9 PHP Stack trace: PHP 1. {main}() /home/tim/Documents/Web/index2.php:0 PHP Fatal error: Function name must be a string in /home/tim/Documents/Web/index2.php on line 9 PHP Stack trace: PHP 1. {main}() /home/tim/Documents/Webindex2.php:0
I located my mysql.so file and set it accordingly in my php.ini, but for some reason the mysql extension doesn't seem to be working... unless there's something wrong with my code.
That's because mysqli_connect
is a function and not a variable. Remove the $
sign.
$dbase = mysqli_connect('localhost', 'root', 'password');
Yeah, remove the $. If you're trying to squelch potential error messages, use @.
精彩评论