0
<?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

Edited by pritaeas: Fixed markdown.

5
Contributors
5
Replies
24
Views
3 Years
Discussion Span
Last Post by diafol
0

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}')";

0

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

Edited by pzuurveen

0

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.

0

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());

}
?>
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.