1

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/Documents/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.

2 Answers 2

5

That's because mysqli_connect is a function and not a variable. Remove the $ sign.

$dbase = mysqli_connect('localhost', 'root', 'password');
Sign up to request clarification or add additional context in comments.

1 Comment

stupid stupid mistake on my part! can't believe i missed that. Thanks!
0

Yeah, remove the $. If you're trying to squelch potential error messages, use @.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.