can anyone help me ? I m not able to connect database. |
[eluser]bhagatwala[/eluser]
--> I am using wampserver --> I have saved file in controllers folder. --> I am able to connect MySQL but not getting connected with Database. --> Message that i am grtting is "databse not found" code that i have written is ________________________________________________________________________________________ <html> <head> </head> <body> <?php $username = ""; $password = ""; $hostname = "localhost"; $con_str = mysql_connect($hostname, $username, $password) or die("MySQL not connected"); echo "MySQL Connected<br>"; $con_db = mysql_select_db("demo",$con_str) or die (" Database not found"); ?> </body> </html> __________________________________________________________________________________________ I have set the config.php file database.php file also
[eluser]NateL[/eluser]
Check out this helpful tutorial: http://www.php-mysql-tutorial.com/wikis/...abase.aspx Also, you are aware that you are asking about procedural programming on a Framework forum.. ? You shouldn't have do do what you're doing with CodeIgniter.
[eluser]NateL[/eluser]
Also, make sure you created the table named "demo" (without quotes)
[eluser]the_namdeeW[/eluser]
I would recommend using the built in connection. The whole reason behind using frameworks is to make your life easier. Just go to /application/config/database.php This defaults to work with MySQL and just fill in the requirements. Then in your controller just add the following line. $this->load->database('default'); Good luck! |
Welcome Guest, Not a member yet? Register Sign In |