<?php
session_start(); 
mysql_connect("localhost","root","");
mysql_select_db("secure");
$name = $_POST['n'];
$address = $_POST['x'];
$order = "INSERT INTO user VALUES('$name','$address')";
if($result)
    { echo("Input data is succeed");}
else
    { echo("Input data is fail");}
?>

Error: No base was selected

post whole stack trace here
also I find your line $order = "INSERT INTO user VALUES('$name','$address')"; not working in most cases so I always do $order = "INSERT INTO user VALUES('{$name}','{$address}')";

don't you mean :
no DATAbase selected?

mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("secure") or die (mysql_error());

also I don't see a mysql_query();
also mysql is deprecated use mysqli or pdo

Member Avatar for diafol

I would deem this question as inadequate to get the response required. Could you please read the php sticky by Pritaeas:

http://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question

If you want help, make sure that you provide all the information necessary. There is no question posed, just a code dump and a slightly dodgy-looking error message. Also think about a suitable title - this is far too cryptic and will not draw the support you may need.

May be there is problem with you connection with database.
try

<?php 

$mysql_host = 'localhost';
$mysql_user= 'root';
$mysql_pass='';
$mysql_db='secure';

if(@mysql_connect($mysql_host, $mysql_user, $mysql_pass)&& mysql_select_db($mysql_db))
{
}
 else
{
    die (mysql_error());

}
?>
Member Avatar for diafol

May be ...

Exactly, "maybe..."

Why are you wasting your time? The OP cannnot be bothered to provide the required info. BTW please don't suggest using mysql_* functions - they're deprecated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.