Well, I have created a config file where I provide the server name,dbname,dbusr name.I include this in another file called create which just creates a table to store userinformation.

So when the login html file gets a user name and password it has to call another page...but it showed a error 'dbname.usertable' not exists. So I tried changed the database name and and tried to use the usertable of that database...this time it was error logging on.....

Well I would like to know the possible reasons .Could you please help me with the reason...

Also if possible the steps you would follow when creating a database for a web application including commands and whether create a user and grant permission for the application database

hari

Could you post your code pls. It will be much easier to help you if we can see your code. Let's start with the page you use to create the database and table.

hi,

thanks for the concern and reply.Pasting the code as asked
--------------------------------------------------------------------
<?

//set up the names of the database and table
$db_name ="phpportal";
$table_name ="authusr";

//connect to the server and select the database
$server = "localhost";
$dbusername = "hbm";
$dbpassword = "hbm";

//domain information
$domain = "//removed";

//Change to "0" to turn off the login log
$log_login = "0";

//base_dir is the location of the files, ie http://www.yourdomain/login
$base_dir = "http://127.0.0.1/userlogin/login";

//length of time the cookie is good for - 7 is the days and 24 is the hours
//if you would like the time to be short, say 1 hour, change to 60*60*1
$duration = time()+(60*60*24);

//the site administrator's email address
$adminemail = "hbmarar@rediffmail.com";

//sets the time to EST
$zone=3600*-5;
?>

//--------------------------------------
//create create.php
//-------------------------------------------
<?

require ('config.php');

$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());

$sql ="
CREATE TABLE IF NOT EXISTS authorize
(
firstname VARCHAR(20),
lastname VARCHAR(20),
username VARCHAR(20),
password VARCHAR(30),
email VARCHAR(100),
authority VARCHAR(20),
redirect VARCHAR(100)
)
";

$result = @mysql_query($sql,$connection) or die(mysql_error());

echo "<p>$table_name has been create.</p>";
echo "<p><a href=\"admin/createadmin.html\">Create Admin</a></p>";
?>

Hope this would give you a picture for helping me out

with regards and Happy new Year wishes(Indian new Year)
Hari

I have checkedthe following too..

mysql server started in win98.logged in as root and checked the table
..it exists and able to insert data from commanline...should i specify use phpportal qurey as a first query....?

In your config you have:

$table_name ="authusr";

but in your query in create.php looks like this:

CREATE TABLE IF NOT EXISTS authorize
(
firstname VARCHAR(20),
lastname VARCHAR(20),.....

and then have:

echo "<p>$table_name has been create.</p>";

so you have not created the table authusr, but have created the table authorize. You can change your query to look like this and things should work better:

$sql ="
CREATE TABLE IF NOT EXISTS $table_name
(
firstname VARCHAR(20),
lastname VARCHAR(20),
username VARCHAR(20),
password VARCHAR(30),
email VARCHAR(100),
authority VARCHAR(20),
redirect VARCHAR(100)
)
";

Happy New Year :)

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.