![]() |
whats wrong in this code ? [i am learning]!
PHP Code:
|
You can't use ' around the variables in the mysql_connection
|
so how would i fix that instead ?
|
Just to expand on that, when you're passing arguments, you don't need any quotes at all around variables, ie
PHP Code:
PHP Code:
|
to expand even further on this, your class variables are not being utilized.
These guys: PHP Code:
Also, constructers are very useful as it will execute as soon as the object is initialized. I ahve the constructor called below to call the two functions. The constructor can be either called __constructor or the exact name of the class in this case: db_connect PHP Code:
PHP Code:
|
Thank you i get it now ;) just because it's private i need to keep it on that same page, so it can read the values i get it all..
TY! |
PHP Code:
|
Quote:
$this->dbn would return results inside of the class, $database_connection = new db_connection(); echo $database_connection->dbn; Should throw some type of error. |
PHP Code:
|
What is wrong now?
whats wrong now :S?
Quote:
PHP Code:
|
This part here:
PHP Code:
PHP Code:
|
it is still not working...
.."No database selected".. |
Meaning: You didn't select a database.. ? :-P? So select a database
|
so what you call this then ?
$this->showConnectionDetails('zone'); Read the code ;) |
Quote:
Well, maybe you haven't set private $db_selected ? :-P Also, you can use this: PHP Code:
|
PHP Code:
PHP Code:
PHP Code:
|
Tanax, please read the code before saying something.. ps, ty all for the help!
but it is still not working... anyone with a clue why =?.. |
Another tip:
this could be shortened PHP Code:
PHP Code:
|
Quote:
|
Quote:
|
| All times are GMT. The time now is 11:47 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0