$name = $_POST['n'];
$address = $_POST['x'];
$order = "INSERT INTO user VALUES('$name','$address')";
    { echo("Input data is succeed");}
    { echo("Input data is fail");}

Error: No base was selected

Recommended Answers

All 5 Replies

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:


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.


$mysql_host = 'localhost';
$mysql_user= 'root';

if(@mysql_connect($mysql_host, $mysql_user, $mysql_pass)&& mysql_select_db($mysql_db))
    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.