i have a list and mysql table. my goal is to make the links active if there is a game in its section:

this is my code:

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM gameChart");

$row = mysql_fetch_array($result);

echo "<dl><dt>Writer's Forge</dt>";
if (!$row["secID"] == 1){   
echo "<dd>Collaborated Poetry</dd>";}
else { echo "<dd><a href='showcase'>Collaborated Poetry</a></dd>";}
if (!$row["secID"] == 2){   
echo "<dd>Collaborated Sreenplays</dd>";}
else { echo "<dd><a href='showcase'>Collaborated Sreenplays</a></dd>";}

It keeps making all the links active.

Hey,

I'm guessing 1 = active, 2 = not active..

<?php

    mysql_select_db("my_db", $con);

    $result = mysql_query("SELECT * FROM gameChart WHERE secID=='1'");
    echo "<dl><dt>Writer's Forge</dt>";

    if(mysql_affected_rows() == 1)
    {
        echo "<dd>Collaborated Poetry</dd>";

    }else{
    echo "<dd><a href='showcase'>Collaborated Sreenplays</a></dd>";

    }


?>

Could try this.. I mean, I'm not too sure why you need to fetch the row, only if you wanted to display the actual row that I would do this.

This might helo you :)

1-22 are the diffrent numbers of the sets

Are you sure this is the correct method to completing this?

I mean, if there are 1-22 sets, are you going to have an if statement for each set?

I have that already I only showed the first 2

Okay, did you try the code? It should work!

Actually Phorce, in the code you gave him, your sql query only selects those from the database that are active. I believe he wants everything selected from the database and those that are active to be displayed with a link, and those that are inactive to display without a link.

The piece of code that has not been included in his example is the variable from the database that specifies weither it's "Collaborated Poetry" or "Collaborated Screenplay."

I believe you want something more like this:

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM gameChart");

echo "<dl><dt>Writer's Forge</dt>";

while ($row = mysql_fetch_array($result)) {
    extract($row);

    if ($row["secID"] == 1) {
        echo "<dd><a href='showcase'>".$row["collab_type"]."</a></dd>";
    }else{
        echo "<dd>".$row["collab_type"]."</dd>";
    }
}

With $row["collab_type"] being whatever variable from the database defines Collaborated Poetry or Collaborated Screenplay.

Wouldn't "collab_type" just be the name?

I have like 22 of these types and I'm just trying to do this:

My mysql table is a list of collaborations. "secID" only goes from 1-22 by the user input on the pages before.

If there is a record with a secID of a specific type of collaboration, u want it to be a link to "showcase. PHP. If not, I want it to just be text.

I get what you mean. But if secID specifies what type of collaboration it is, then what specifies if it is an active link or not?

the record in the mysql with that secID

One value can not specify link text and an active link. That is why every link keeps being active, because there is always a value. Unless you say that secID=0 is for an inactive link. But if that's the case, what text is displayed?

Maybe what you want is something like this:

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM gameChart");

echo "<dl><dt>Writer's Forge</dt>";

while ($row = mysql_fetch_array($result)) {
    extract($row);

    if ($row["secID"] > 0) {
        switch($row["secID"]) {
            case 1: echo "<dd><a href='showcase'>Collaborated Poetry</a></dd>";
            break;
            case 2: echo "<dd><a href='showcase'>Collaborated Screenplay</a></dd>";
            break;
            ...
            case 22: echo "<dd><a href='showcase'>[Text goes here]</a></dd>";
            break;
        }
    }else{
        echo "<dd>[Whatever text for inactive links]</dd>";
    }
}

still not working out :/ imma find another way

If that code I gave you isn't working, then you've either done something wrong, or you just haven't explained what it is you want correctly. I'm willing to help you, but I'm going to need more information on what it is you want. Maybe you can send me some of your code or examples, and some of your database stuff so I can further assist you. I also have TeamViewer which would allow us to share your monitor and solve it together.