I'm learning about php language. Making statements such as how to connect to mysql database.
I'm learning about php language. Making statements such as how to connect to mysql database.
Did you have a question?
To choose the lesser of two evils is still to choose evil. My personal site
I think he is asking how do you connect to a database in php:
Here is a good way to start:
http://www.w3schools.com/php/php_mysql_connect.asp
-DW [Deadweight]
Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved
you really need to ignore the above post to use MYSQL or MYSQLI they are depricated in php5.3 adn GONE in php5.4
if you use mysql(i) you will Never be able to upgrade beyond php 5.3 unless you rewrite your script.
As I said before that statement is just not true. Traq wrote a very good post on this topic.
Mysql_connect is deprecated, but not removed in any version of php. Mysqli_connect is actively supported and encouraged and there are no plans to remove it for the foreseeable future. The same is true for PDO. reference scroll down to the comparison chart for the status on each of the three main methods for connecting to MySQL using php, which includes mysql_connect.
Deadweight's response is perfectly valid.
Last edited by james438; 09-26-2014 at 01:17 AM.
To choose the lesser of two evils is still to choose evil. My personal site
PHP Code:$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Not connected');
}
$db_selected = mysql_select_db('foo', $link);
if (!$db_selected) {
die ('database is not selected');
}
Last edited by keyboard; 06-30-2019 at 07:27 AM. Reason: Format: PHP Tags
Bookmarks