Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: header

  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    header

    Hola,

    I hope somebody will help me in figuring out a solution for my problem.

    In the following url,

    http://www.sarath.iwebland.com

    you can see "Courses".when you click on it, you get "Major subjects" listed and when you click on the first one, communication engineering, some information is displayed.
    Here on this page, you can notice, there is a heading with a back ground image and on the left side, there is "courses" and on the right side there is "back" which gets you to the previous page.

    I strictly did this one using simple HTML.I'm implementing a similar example using PHP and mysql, where I'm listing some topics(Ex:courses) and when you click on a topic, you show some sub-topics(Ex:major subjects) along with articles(ex: communication engineering) and when you click on articles you show their text(a file name is stored in the table)

    Here how my article table looks like
    ------------------------------------------

    article_id topic_id subtopic_id article_name article_content
    1 1 1 communicationengineering info.html

    PHP Code:

    <?php 
        
    include "../dbconnection.dam"
    ?> 

    <html> 
    <head> 
    <title>mypage</title> 
    </head> 
    <body> 

    <? 
        $select_query 
    "SELECT ARTIKEL_NAME, ARTIKEL_CONTENT FROM artikel where subtopic_id = 1 ORDER BY ARTIKEL_ID DESC"
        
    $result mysql_query($select_query); 
        
    $numrows mysql_num_rows($result); 
        while(
    $row mysql_fetch_array($result)) 
        { 
    ?> 
    <table border="1" cellpadding="2" cellspacing="2" width="275"> 

      <tr> 
          <td width="280">&amp;nbsp; 

    <? 
        
    echo "<a href='".$row[ARTIKEL_CONTENT]."'>".$row[ARTIKEL_NAME]."</a>"
    ?> 

         </td> 
      </tr> 
    </table> 
    <? 
        

    ?> 
    </body> 
    </html>

    So, the above code shows all the article names and when we click on each article, its file is shown.

    Now, i want to show the heading on my article content.How can i do that??

    Please help me.

    Sorry for the lengthy post.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm afraid I don't see any heading text in the example you posted, so I'm not quite sure where your problem lies. Why don't you store the article's heading in a separate field in your database and extend your SQL statement?

  • #3
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    Thanks.But, this url gives you an idea what exactly what I'm trying to do.But, this is purely html.I'm trying to do all this in PHP.

    http://www.sarath.iwebland.com

    Courses is a topic name.Major subjects is a subtopic name.Communication engineering is a article name and when you click on comm.engg, you see a text displaying with a heading which has brown background and on it stating "courses" on the left side and "back".I just want to put this heading automatically when i click any article name corresponding to that particular topic.

    What I'm doing is
    1 - Get all the topic names from the table on the navigation bar.
    2 - Click on a topic name and show the sub-topic name and below that show all the article names corresponding to the sub-topic.Click on the article name and show the article content.

    How my table structure looks like:

    1.topic(topic_id, topic_name)
    2.subtopic(subtopic_id, topic_id, subtopic_name)
    3.article(article_id, topic_id, subtopic_id, article_name, article_content)

    Let me give one example:
    topic_id : 1
    topic_name : courses
    subtopic_id : 1
    subtopic_name : main subjects
    article_id : 1
    article_name : communication engineering
    article_content : text1.html

    So, now text1.html file will display when you click on communication engineering.

    "STRICTLY, I DONT WANT TO PLACE THIS HEADING IN THE TEXT1. FILE BECAUSE THERE ARE SO MANY ARTICLE NAMES AND I WANT TO SHOW THE HEADING AUTOMATICALLY ON THE ARTICLE CONTENT WHEN I CLICK ON ANY ARTICLE NAME CORRESPONDING TO THAT TOPIC".

    I want to implement the same heading as i showed in the above url.



    Thanks everybody.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, apparently I wrongly saw your heading text and thought it was article content. But anyway, if those headings are dependant on which topic was chosen, you can store them in a separate table with heading_id, topic_id, heading_text and join that in your SQL statement. The joining criterium would be the topic_id. Or you retrieve the right heading by a second query, but I'd prefer a JOIN solution.

  • #5
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    mordred,

    Sorry, I really did not understand.

    Could you pls help me with the code.or would like to see the code which I've written so far.

    thanks for your time

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, you add one additional table to your database (let's call the table "heading"). It should have three fields, and the SQL to create it might look like this (typed on the run so watch out for obvious bugs):

    Code:
    CREATE TABLE heading (
    heading_id INT(5),
    topic_id INT(5),
    heading_text CHAR(250)
    );
    heading_id identifies one particular heading text. The topic_id field refers to which topic section this heading belongs to. When you select the appropriate you launch a SQL query like this:

    SELECT heading_text
    FROM heading
    WHERE topic_id = $myTopicId
    Of course, $myTopicId must consist of an integer value indicating which heading to select. This all assumes that you know the topic_id on each sub-page.

    Is that of any help to you? If not, try to narrow down your problem more. Is it with the SQL queries in general or with PHP fetching the data from the database? Or is my english just too weird?

  • #7
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hallo mordred,

    your english does'nt sounds weird.I feel as if i aint explaining the problem well.

    Anyways, I've a got form where i enter the articles into the table.A simple form though: select a topic from the list box, hit the button, sub-topics are shown in another list box.select them and enter the article name and its content(the file name) and submit it.

    Now, coming to your tip: you said to me that we need a table to store the heading details, basically heading text.
    well, here in my example it would be "courses" nothing but the topic name.

    So, do you think its the right way of doing it??because we already have the topic name stored in a table and we have the relation between all the 3 tables.So, why dont we make a reverse look up??

    I've all the theoretical ideas with me, but aint have a clue to implement it.huh, kinda disapointment, gosh!!

    Thanks for your time


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •