Welcome Guest, Not a member yet? Register   Sign In
User System
#41

[eluser]jcavard[/eluser]
[quote author="majidmx" date="1233218253"]Please pay more attention to the user_guide.
[...]
When you face an error which seems to be so simple, there should be something wrong with your code, spend more time on tracing your code, though the error itself is self-explaining.
[/quote]

WORD!
#42

[eluser]jcavard[/eluser]
[quote author="plasmagames" date="1233217107"]
Code:
*/the Database Connection Info\*
[/quote]

Dude, this line in your controller, it just can't work! You don't know what you're doin', are you? We're talking basic here!
Comments in PHP goes like
Code:
// the Database Connection Info (single line comment)
# the Database Connection Info (single line comment)

/*
the Database Connection Info (bloc comment)
*/
#43

[eluser]plasmagames[/eluser]
dude, i just took out the database connection info for the thread, god, give me a break, i don't want my database info out there.
#44

[eluser]jcavard[/eluser]
Your database information belongs in the database config file
(system/application/config/database.php). Why would you put this info in each of your controllers? This is the point of OO, avoid redundancy. If you set the db info properly in the database.php config file, you should have no need to pass any $config array, it will look it up automatically.

And if you have multiple databases, again, look in the User_Guide for a detailed how-to, but to make it short,
Code:
// Connect to $config['default']
$this->load->database();

// Connect to $config['myOtherDB']
$this->load->database('myOtherDB')


config/database.php EXAMPLE
Code:
// In your case, the data you took out of the controller would go here in the 'default'
$db['default']['hostname'] = 'host';
$db['default']['username'] = 'usr';
$db['default']['password'] = 'pwd';
$db['default']['database'] = 'db';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

$db['myOtherDB']['hostname'] = 'XE';
$db['myOtherDB']['username'] = 'hr';
$db['myOtherDB']['password'] = 'hr';
$db['myOtherDB']['database'] = '';
$db['myOtherDB']['dbdriver'] = 'oci8';
$db['myOtherDB']['dbprefix'] = '';
$db['myOtherDB']['pconnect'] = TRUE;
$db['myOtherDB']['db_debug'] = TRUE;
$db['myOtherDB']['cache_on'] = FALSE;
$db['myOtherDB']['cachedir'] = '';
$db['myOtherDB']['char_set'] = 'utf8';
$db['myOtherDB']['dbcollat'] = 'utf8_general_ci';

As for the break, it's unlikely that I will give you any...(H)
#45

[eluser]plasmagames[/eluser]
my app isn't getting the info from the database! and i know that you are supposed to get the database info from the database.php file but right now i want to get the app working.

Edited by Michael Wales.
#46

[eluser]jcavard[/eluser]
[quote author="plasmagames" date="1233353901"]ok if you have read this thread for some reason my app isn't getting the info from the database so shut up! and i know that you are supposed to get the database info from the database.php file but right now i want to get the app working.[/quote]

hahaha
Edited by Michael Wales.
#47

[eluser]plasmagames[/eluser]
It's not working right out of the box, apparently.

Edited by Michael Wales.
#48

[eluser]jcavard[/eluser]
come on
#49

[eluser]Michael Wales[/eluser]
Okay children - enough is enough. We don't swing around these forums calling one another fucktards. If you want to help someone, do so - if not, ignore the thread. There is no magic stick compelling you to open and respond to every post.

Any further rude comments posted in this thread will be edited to make you sound like a tool, until I get a chance to clean this thread up.




Theme © iAndrew 2016 - Forum software by © MyBB