My dbconfig.php:
<?php
/**
* db_config.php
* MySQL connection parameters for 140dev Twitter database server
* Fill in these values for your database
* @license GNU Public License
* @version BETA 0.30
*/
$db_host = '127.0.0.1';
$db_user = ‘root’;
$db_password = ‘’;
$db_name = ‘Realtime’;
// MySQL time zone setting to normalize dates
define('TIME_ZONE','America/New_York');
?>
When I start the script in the terminal, it loads up nicely, but when it wants to write to the database i get these messages
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 97
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 47
So I figured it can't connect to the database.
I ran the db_test.php from the browser. It gave me this:
Notice: Use of undefined constant ‘root’ - assumed '‘root’' in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_config.php on line 12
Notice: Use of undefined constant ‘’ - assumed '‘’' in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_config.php on line 13
Notice: Use of undefined constant ‘Realtime’ - assumed '‘Realtime’' in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_config.php on line 14
Warning: mysqli_connect(): (HY000/1045): Access denied for user '‘root’'@'localhost' (using password: YES) in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 23
Warning: fopen(error_log.txt): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 59
Warning: fwrite() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 62
Warning: fclose() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 63
Twitter Database Tables
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 89
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_lib.php on line 47
Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given in /Applications/XAMPP/xamppfiles/htdocs/Realtime/db/db_test.php on line 15
Strange thing is, that when I wrote my own test:
<?php
$user = 'root';
$pass = '';
$db = 'Realtime';
$db = new mysqli('localhost', $user, $pass, $db) or die("Unable to connect");
echo "Great work";
?>
It passed..
I have no clue what I'm doing wrong