![]() |
Adding database name within the initial parameters
Hey,
What I'm trying to accomplish is add the database name within the first line to avoid having two lines. This is what I mean: PHP Code:
I'm trying to avoid this: PHP Code:
PHP Code:
|
In your
__construct method, after $this->connect(); add $this->select(); |
I just tried that and get a fatal error:
Code:
Fatal error: Uncaught exception 'Exception' in C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php:31 Stack trace: #0 C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php(15): mysql->select() #1 C:\Users\9three\Desktop\Server\htdocs\gb\index.php(8): mysql->__construct('localhost', 'root', '', 'cms') #2 {main} thrown in C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php on line 31 |
The error is very clear, an Exception has been thrown but you have nothing in place to catch it. Wrap your code (not the class) in a try/catch block and see which exception is being thrown:
PHP Code:
|
I was actually doing that as you replied. But I still get the same error:
Code:
exception 'Exception' with message 'No database selected' in C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php:40 Stack trace: #0 C:\Users\9three\Desktop\Server\htdocs\gb\index.php(11): mysql->query('SELECT ID, User...') #1 {main}Code:
exception 'Exception' in C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php:31 Stack trace: #0 C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php(15): mysql->select() #1 C:\Users\9three\Desktop\Server\htdocs\gb\index.php(9): mysql->__construct('localhost', 'root', '', 'cms') #2 {main} |
You need to specify a database with
mysql_select_db. |
I am in my select method.
|
| All times are GMT. The time now is 09:55 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0