i have a problem connecting to mysql database:
i read in some places that there are two ways, mysqli and mysql... and now im really confused...
could someone write me a connection code to a database, only that..
is it something like this:
| Code: |
$connection = mysql.connect('username','pass','database name');
|

| alalex wrote: |
i have a problem connecting to mysql database:
i read in some places that there are two ways, mysqli and mysql... and now im really confused...
could someone write me a connection code to a database, only that..
is it something like this:
| Code: | $connection = mysql.connect('username','pass','database name');
|
 |
| Code: |
// Database Information
$host="localhost";
$username="alalex"; // Your mySQL username
$password="Password Here"; // Your mySQL password
$db_name="alalex_database-name"; // Your database name
// The Actual Connection
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
|
ok thanks!! 
to connect
mysql_connect($server,$username,$password);
to select a database
mysql_select_db(dbname);
mysqli is better than mysql
this is realative to the topic
when i try to connect to the mysql databse, it always spits out something like this:
Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.:/usr/share/php') in /www/freewebsitespace.net/j/e/w/jewelhorse/htdocs/db_connect.php on line 5
whats that mean?
| Bejeweledhorses wrote: |
this is realative to the topic
when i try to connect to the mysql databse, it always spits out something like this:
Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.:/usr/share/php') in /www/freewebsitespace.net/j/e/w/jewelhorse/htdocs/db_connect.php on line 5
whats that mean? |
I think it means that it could not open your db.php file which container the info to connect to the database. try: | Code: |
require()
//or
include() |
and make sure the path to the file is correct and the permission.
Don't forget to put your files inte the "public_html" folder