#1046 - Aucune base de données sélectionnée

Solved
Hello,

I encountered an error that I can't resolve despite researching online... I'm using WAMP.

So I resumed the creation of PHP pages for a project from here:
http://www.lephpfacile.com/howto/10-comment-faire-un-espace-membre-en-php

and when I execute the SQL query:

1. CREATE TABLE membre (
2. id int(11) NOT NULL auto_increment,
3. login text NOT NULL,
4. pass_md5 text NOT NULL,
5. PRIMARY KEY (id)
6. ) TYPE=MyISAM;

an error appears: #1046 - No database selected.

I created all the pages without changing anything... I tested them, and this is all that remains.

What could be the problem?
Thank you in advance.

16 answers

  1. If there is only "localhost," it means that no database is selected.
    In the vertical sidebar on the left, there should be a list of your databases and a message inviting you to select one. Click on the name of your database; it's probably the only one.
    Note: The presentation may vary slightly depending on the versions of phpMyAdmin.
    1. No! It's the entirety that constitutes a request to create a single table. This table is called "membre" and has 3 fields: "id", "login", and "pass_md5".

      Moreover, if you create a table directly from the phpMyAdmin interface, you will see that upon validation, it generates a query that looks the same.
      1. Hello

        The message tells you that you haven't selected a database.
        Do you think you have selected one? If so, can you tell us how (where did you click, what did you type...) and what its name is?
        1. From the localhost action, I created a database named: Myphp_srv, I left the default "collation" with the utf8_general_ci connection

          I didn't change anything else in the database. The structure is default.
          1. The database is created, that's good, but it still needs to be selected.
            I don't know the WAMP interface, but I assume it uses phpMyAdmin.
            In the central part of the screen, is the first line (at the very top) simply "localhost" or "localhost Myphp_srv"?
            1. It consists only of "localhost", Wamp indeed uses phpMyAdmin.
              1. I see, you were talking directly from the menu. I thought we were talking from the homepage. I am on Myphp_srv. ^^
                1. No, I'm speaking from the phpMyAdmin page. I don't know which menu you're talking about; if it's a WAMP menu, I'm not familiar with it.
                  1. Menu located on the left side of the screen with the names of all the databases. ^^
                    1. Which screen? phpMyAdmin, I suppose? Be precise in your messages, I can't see what you're doing.
                      If you have selected your database, you should see at the top of the central part of the page, localhost - name of your database.
                      And you should be able to create your table.
                      1. Sorry.. I'm moving around a lot... Yes, I'm in localhost - myphp_srv. Indeed, I can create a table that asks for two fields.
                        The name:
                        Number of columns:

                        I think there will be only one column? And the name is up to me?
                        1. In a database, a column or field denotes the same thing. So if you want two fields -> 2 columns.
                          As for the names, you are free as long as you adhere to the MySQL rules. To keep it simple: start with a letter, avoid spaces, accented characters, and other weird characters.
                          But the query you suggested in your first message (by removing the line numbers) should work too.
                          1. If I understand correctly? Each line of coding in my first message composes a different table?
                            1. Ah! I see! Great! And in these three fields or columns, he offers me several choices such as type, value/size, default², collation, attributes, null, index, auto_increment!

                              What should I do? INT type for id, varchar for login? 11 for the value? Do you have any clarification to detail the criteria for me?
                              1. We're getting far away from the original question. What you need is a complete course on databases!
                                Without going as far as a full course, there are said to be excellent introductions on the site du zéro (it's a real site, not an insult ^^).
                                1. I participated in a few news articles on the Site du Zéro... I think I will go check it out!

                                  Thank you for your explanations! I'm marking the post as resolved ;)