0
i have implement one application that contains some page of php and some page of asp.net. and i have deploy this app in iis server.Application is working fine with local data.but database does not connect with live database.

connection string in php file given below:

`$conn=mysql_connect("example.com","user_name","password") or die(mysql_error());
$db = mysql_select_db("database_name",$conn);

`

connection string in web.config:

<add name="LocalMySqlServer" connectionString="Datasource=example.com;Database=database_name;uid=user_name;pwd=passwd;convert zero datetime=True" providerName="MySql.Data.MySqlClient"/>

1 Answer 1

1
$hostname_localhost ="localhost";
$database_localhost ="u2us";  //datbase name
$username_localhost ="root";
$password_localhost ="";
$localhost = mysql_connect($hostname_localhost,$username_localhost,$password_localhost)//connection of localhost
or
trigger_error(mysql_error(),E_USER_ERROR); //generate error report whether connection is failed.
mysql_select_db($database_localhost, $localhost); //select db
Sign up to request clarification or add additional context in comments.

2 Comments

does OP need to install .net connector? just curious ... also your code doesn't show how to connect to MySQL db using .net code
thank you for reply.but this is technique to use local database i want to connect local application with live database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.