•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,664 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,382 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 768 | Replies: 2
•
•
Join Date: Jun 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
My first PHP-MySQL project is to build a very simple web based index for archive issues of a small independently published journal. One problem that I'm struggling with involves the detailed display for a single article for a single issue of the journal (a page that the user reaches by clicking on the content list of a particular issue).
The problem is embarrassingly basic: while each individual article has only one title, author-string, issue no, start page, end page, etc, it may have 4-5 different keywords attached to it. Problem is that my current (extremely simple) query and code is looping through all of the data once for each of the keywords attached to a particular article. (So the detailed display of author, title, issue, etc appears fine - with the first keyword displaying and then again with the second keyword displaying and so on.)
I know that I need to do something clever with arrays to return the original query and then build separate outputs within the page... but as a humble newbie I'm struggling not to identify a simple way to do this. If anyone can set me off along the right path here, I'd be very grateful...
The problem is embarrassingly basic: while each individual article has only one title, author-string, issue no, start page, end page, etc, it may have 4-5 different keywords attached to it. Problem is that my current (extremely simple) query and code is looping through all of the data once for each of the keywords attached to a particular article. (So the detailed display of author, title, issue, etc appears fine - with the first keyword displaying and then again with the second keyword displaying and so on.)
I know that I need to do something clever with arrays to return the original query and then build separate outputs within the page... but as a humble newbie I'm struggling not to identify a simple way to do this. If anyone can set me off along the right path here, I'd be very grateful...
language Syntax (Toggle Plain Text)
if (isset ($HTTP_GET_VARS['content_id'])) { $SQLQuery = "SELECT * FROM content,content_author,content_issue,content_keywords,keywords,content_type WHERE content.author_id=content_author.author_id && content.issue_id=content_issue.issue_id && content_keywords.keyword_id=keywords.keyword_id && content.content_id=content_keywords.content_id && content_type.type_id=content.type_id && content.content_id = ".$HTTP_GET_VARS['content_id']; } ELSE { $SQLQUERY = "SELECT * FROM content"; } $result = mysql_query($SQLQuery,$connection); mysql_close($connection); ?> <p>Result from: <strong><?=$SQLQuery ?></strong></p> <? while ($output_row = mysql_fetch_array($result)) { ?> <h1><?=$output_row["content_mtitle"]?><br /></h1> <h2><?=$output_row["content_stitle"]?><br /></h2> <h3><?=$output_row["author_first"]?> <?=$output_row["author_last"]?></h3><br /> <strong>Abstract</strong>: <?=$output_row["content_abstract"]?><br /> <br /> <strong>Issue Number:</strong> <?=$output_row["issue_no"]?><br /> <strong>Pages</strong>: <?=$output_row["content_spage"]?>-<?=$output_row["content_epage"]?><br /> <strong>Type:</strong> <?=$output_row["content_type"]?><br /> <strong>Issue Theme:</strong> <?=$output_row["issue_theme"]?><br /> <strong>Issue ISSN:</strong> <?=$output_row["issue_issn"]?><br /> <strong>Issue ISBN:</strong> <?=$output_row["issue_isbn"]?><br /> <strong>Keyword:</strong> <?=$output_row["keyword"]?><br /> <br /> <br /> <? } ?>
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- desktop problem Plz help (Viruses, Spyware and other Nasties)
- Help me with this Simple Problem plss (C)
- Problem with Character Arrays (C++)
- Declaration of dynamic pointer array puzzle. (C)
- BUTTON DOES NOT WORK??? simple problem (C)
- How do I create a program using an Array ? (C++)
- Array limit (C)
Other Threads in the PHP Forum
- Previous Thread: PHP and MySQL
- Next Thread: php read text scanned from other text editor



Threaded Mode