I don't quite understand your question... are you trying to generate links to articles from your index.php based on a DB query?

    If someone clicks on lets say www.mysite.com/article.php?id=2 then on the article.php page, you use $_GET['id'].

    so in this instance on the article.php page:

    echo $_GET['id'];
    

    would print the value 2

      tron00;10897744 wrote:

      If someone clicks on lets say www.mysite.com/article.php?id=2 then on the article.php page, you use $_GET['id'].

      so in this instance on the article.php page:

      echo $_GET['id'];
      

      would print the value 2

      i still didnt get what to do in index.php

      and how to recive the $_GET to article.php page (with the ID of the article) :[

        We're not psychic. We don't know anything about your database. But at a guess you have a table that has a column that has article IDs in it. So you'd query for those IDs, and put them in the links. Which bit are you having trouble with?

          ill say it again from the beginning.

          i have a DB. in the DB i have id.
          i showing the ID's in the index.php page.
          when someone click on ID i want to send him to article.php page.
          when he gets to the article.php page he will see the article.

          its very simple, everyone is using it..i just dont know how they call it..

            Right. So you have listed out the steps:

            i showing the ID's in the index.php page.
            when someone click on ID i want to send him to article.php page.
            when he gets to the article.php page he will see the article.

            The middle step is more of a user action, so we can ignore that. Now, which of the other two steps are you having problems with, and what exactly is the problem?

              i dont have any problem.

              i just dont know how to do that.

                i call it details page:

                <?php
                
                if ( !empty( $_GET["id"] ) ) {
                /* if you set an article variable*/
                
                			include_once( "connect.php" );
                /* Lets select from the articles table that article where the id is $_GET["id"]  */
                				$sql = "SELECT * FROM articles WHERE id=" . (int)$_GET["id"];
                				$result = mysql_query( $sql );
                				if ( mysql_num_rows( $result ) > 0 ) {
                
                							$rows = mysql_fetch_assoc( $result );
                /* These field names just for example!  */
                								print "Article_Category:" .  $rows["Article_Category"]  . "<br>\r";
                								print "article_title:" . $rows["article_title"]  . "<br>\r";
                								print "Article_body:" .  $rows["Article_body"]  . "<br>\r";
                				}else
                								print "No article found";  /* You did not find that article*/
                }
                
                ?>
                  visualed wrote:

                  i dont have any problem.

                  i just dont know how to do that.

                  Oh, so the problem is that you are at a complete loss as to how to get started 🙂

                  You need to give us more information on what you already know. For example, do you know how to retrieve the IDs from the database? Do you have any idea how to get the data submitted from a form? (E.g., did tron00's post make any sense to you?)

                    laserlight;10897917 wrote:

                    Oh, so the problem is that you are at a complete loss as to how to get started 🙂

                    You need to give us more information on what you already know. For example, do you know how to retrieve the IDs from the database? Do you have any idea how to get the data submitted from a form? (E.g., did tron00's post make any sense to you?)

                    i know the basic. i know how to INSERT and get info from a DB.
                    i just donk know how to do ex:

                    <a href="articles.php?id=" .$bla. "></a>";

                    how does this system works. ive search in Google and find nothing
                    because i dont know how its named. 😕

                      so in index.php you want an output of

                      http://yoursite.com/articles.php?id=1
                      http://yoursite.com/articles.php?id=2
                      ...etc
                      http://yoursite.com/articles.php?id=34

                      if so, it would look something like this:

                      $query = "SELECT id FROM articles ORDER BY id ASC";
                      $result = mysql_query($query) or die(mysql_error());
                      while ($row = mysql_fetch_array($result)) {
                      	echo "<a href='articles.php?id=".$row['id']."'>http://yoursite.com/articles.php?id=".$row['id']."</a><br />\n";
                      }
                      

                      from there you have to use something like djjjozsi showed to display the article in articles.php

                        Write a Reply...