I'm having an issue SELECT to database, I been working on it all day. I'm still new to MYSQL.

I created a table: Records

Table: Records
Fields: id (INT(25), primary key, No Null, auto-increment)
Fields: title (VARCHAR(256), No Null)
Fields: content (TEXT, No Null)

<php if (isset ($ _POST ['submit'])) {
          $ title = $ _POST ['title'];
          $ content = $ _POST ['content'];

          $ register = "INSERT INTO records (title, content) VALUES ('$ title', '$ content')";
          $ qr = mysql_query ($ register);
              if ($ register> = 'l') {
                   echo "Your post was published";


<form action="" method="post" enctype="multipart/form-data">
<span> Title </ span> <input type="text" name="title" size="50" /> <br /> <br />

<textarea name="content" rows="15" cols="80">
</ textarea> <br />

<input type="submit" name="submit" value="Submit" />
</ form>


      $ select = "SELECT * FROM Records";
      $ qrone = mysql_query ($ select);
          while ($ ln = mysql_fetch_array ($ qrone)) {
      <h2> <? php echo $ ln ['title'];?> </ h2>
       <? php echo $ ln ['content'];?>


I get this error:

mysql_fetch_array() expects parameter 1 to be resource, boolean given in

$qrone = mysql_query ($ select);

so I put

$qrone = mysql_query ($ select) or die (mysql_error());

to check the error.

It said "No database selected"

I mean I connected the database and it's working.

Is there any solution for this error?

I really appreciate if someone explain to me how to this works correctly. Thanks!

5 Years
Discussion Span
Last Post by LastMitch


Thanks for the reply and also thanks for the link! I will look into it and test it out. If I have any issue, I will post it Thanks!



Thanks for the link! I finally got it working now! I appreciate your help. Thanks!

This question has already been answered. 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.