Jump to content

Creating a table?


eduard

Recommended Posts

Why can´t I create a table?Code:<html><body><?php$con = mysql_connect("localhost","eduard","-q.w,emr;if (!$con){die ('Could not connect: ' . mysql_error());}// Create databaseif (mysql_query ("CREATE DATABASE my_db2",$con)){echo "Database created";}else{echo "Error creating database: " . mysql_error();}// Create tablemysql_select_db("my_db2", $con);$sql = "CREATE TABLE Persons{FirstName varchar (15),LastName varchar (15),Age int}";// Execute querymysql_query($sql, $con);mysql_close($con);?></body></html>

Link to comment
Share on other sites

well, did you ever solve this problem? You're not going to get a different answer just because you make a new thread about it....http://w3schools.invisionzone.com/index.php?showtopic=36442also, this line looks very wrong

$con = mysql_connect("localhost","eduard","-q.w,emr;

is that really your password? (you shouldn't dispay your login information online). You are also missing the closing quote and the closing parenthesis.are you getting any feedback form the script? error messages? Have you tried commenting out parts to see at what point it works and at what point it doesn't?

Link to comment
Share on other sites

well, did you ever solve this problem? You're not going to get a different answer just because you make a new thread about it....http://w3schools.invisionzone.com/index.php?showtopic=36442also, this line looks very wrong
$con = mysql_connect("localhost","eduard","-q.w,emr;

is that really your password? (you shouldn't dispay your login information online). You are also missing the closing quote and the closing parenthesis.are you getting any feedback form the script? error messages? Have you tried commenting out parts to see at what point it works and at what point it doesn't?

Thanks!
Link to comment
Share on other sites

well, did you ever solve this problem? You're not going to get a different answer just because you make a new thread about it....http://w3schools.invisionzone.com/index.php?showtopic=36442also, this line looks very wrong
$con = mysql_connect("localhost","eduard","-q.w,emr;

is that really your password? (you shouldn't dispay your login information online). You are also missing the closing quote and the closing parenthesis.are you getting any feedback form the script? error messages? Have you tried commenting out parts to see at what point it works and at what point it doesn't?

If I don´t write a password (of MAMP!), I won´t have access to the database!
Link to comment
Share on other sites

If I don´t write a password (of MAMP!), I won´t have access to the database!
:) Yes, we know that. scientist was only stating that you should not post your login information in the forum (or anywhere else online). You should edit that information out when you post code.
Link to comment
Share on other sites

I changed my password, but I need it for my webserver (MAMP)!I don´t understand! To create a table of e. g. Persons (a, b, c, d, etc.)! Where are these persons stored? In a separate .php file (in my case my_db)? In the .php file which is connected to MySQL (and creates a database)?

Link to comment
Share on other sites

I changed my password, but I need it for my webserver (MAMP)!I don´t understand! To create a table of e. g. Persons (a, b, c, d, etc.)! Where are these persons stored? In a separate .php file (in my case my_db)? In the .php file which is connected to MySQL (and creates a database)?
there is no relation beetween your table(person) and php. table person is created on your server which is accessible through mysql.your php file which is conected with the mysql will only help you to work with those data which are stored in database.
Link to comment
Share on other sites

there is no relation beetween your table(person) and php. table person is created on your server which is accessible through mysql.your php file which is conected with the mysql will only help you to work with those data which are stored in database.
Ok, thanks! But has the table created by me to be a.php file or.doc file, etc.?
Link to comment
Share on other sites

The database bears no technically direct relation to the filesystem. You don't create table "files". Why are you so insistent in knowing, anyway?

Link to comment
Share on other sites

Will you replace

$con = mysql_connect("localhost","eduard","-q.w,emr;

with

$con = mysql_connect("localhost","root","");

already?I've been trying to tell you to try this in your other topic.

Link to comment
Share on other sites

Will you replace
$con = mysql_connect("localhost","eduard","-q.w,emr;

with

$con = mysql_connect("localhost","root","");

already?I've been trying to tell you to try this in your other topic.

Yesterday 20.34 REPLACED!
Link to comment
Share on other sites

The database bears no technically direct relation to the filesystem. You don't create table "files". Why are you so insistent in knowing, anyway?
Because I don´t see a table on my database which I created!
Link to comment
Share on other sites

Because I don´t see a table on my database which I created!
how do you know?if you have successfully created a table in a database that you have also successfully created, then it should be visible in phpMyAdmin.if you don't see the database, then go back to your script and fix it till it works. Now that you have successfully created a database, make a script to create a table. Once that works, input data into it....After each step, wherein you have your script returning a success message upon creation, open up phpMyAdmin and verify for yourself.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...