php - Replacement for deprecated function mysql_connect -


this question has answer here:

so have amazon web service database set up

i'm working off old tutorial application i'm planning on using with.

i noticed mysql_connect deprecate when looked up.

what can use alternative? how can connect amazon database?

<? mysql_connect("localhost", "username", "password") or die ("can't connect database server"); mysql_select_db("videorecorderdemo") or die ("can't select database"); mysql_query("set names 'utf8'"); ?> 

i error:

warning: mysql_connect() [function.mysql-connect]: access denied user 'username'@'192.168.1.1' (using password: yes) in /www/zxq.net/r/e/d/red5vptest/htdocs/utility/db.php on line 2 can't connect database server 

no matter credentials use. doesn't amazon's code samples show connecting in entirely different way.

the documentation php says

this extension deprecated of php 5.5.0, , removed in future. instead, mysqli or pdo_mysql extension should used.

$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');  /*  * "official" oo way it,  * $connect_error broken until php 5.2.9 , 5.3.0.  */ if ($mysqli->connect_error) {     die('connect error (' . $mysqli->connect_errno . ') '             . $mysqli->connect_error); } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -