• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can anyone help me ? I m not able to connect database.

--> 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
$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");

I have set the config.php file database.php file also

Check out this helpful tutorial:

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.

Also, make sure you created the table named "demo" (without quotes)

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.
Good luck!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.