Re: What's the best way to go about this?
Alright, so I am back with this code:
[code:33biwu6i]
<?php
if (isset($_ GET['page'])) {
$page = ($_ GET['page']);
@ include "inc/" . $page . ".php";}
else{
$query = "SELECT cont_id, cont_title, cont_sec, cont_sec2 FROM article";
$result= mysql_query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
#variables:
$id = $row['cont_id'];
$title = $row['cont_title'];
$sec = $row['cont_sec'];
$sec2 = $row['cont_sec2'];
if ($row['cont_sec']="Photoshop"){
#echo everything out into a table:
echo "<tr>";
if ($sec2="Beginner"){
echo "<td><a href=view.php?artid=" . $id . ">" . $title . "</a></td>";}
elseif ($sec2="Intermediate"){
echo "<td><a href=view.php?artid=" . $id . ">" . $title . "</a></td>";}
elseif ($sec2="Advanced"){
echo "<td><a href=view.php?artid=" . $id . ">" . $title . "</a></td>";}
echo "</tr>";
}}}?>
[/code:33biwu6i]
it checks to see if the $page value has been set, this is so that clicking on the main interface links will override anything else (i'm explaining it weird but it works
then if it $page isn't set it tries to query the DB to get info on all the articles.
I only want articles who's cont_sec value is "Photoshop" so I tired using an if() statement
and then I tried to organize the "Photoshop" articles into three columns based on the cont_sec2 value of "Beginner", "Intermediate", or "Advanced".
Right now it shows three columns with article 1 & article 2 both under Beginner even though Article 2's cont_sec2 value is Intermediate.
Any ideas where I'm going wrong?