Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:15:21+00:00 2026-06-05T14:15:21+00:00

this code let’s me view al the problems that are reported and they are

  • 0

this code let’s me view al the problems that are reported and they are order by date ( the oldest on top). I need to insert something to let me view the problems within each Category. The category’s are identified with Categorie_ID. Any help?

    <?php
$db=mysql_connect("localhost","username","password") or die("Kan niet verbinden: ".mysql_error());
mysql_select_db(,$db);

$sql = "SELECT * FROM Probleem ORDER BY Datum ASC";
$resultaat  = mysql_query($sql); // voer SQL code uit

echo "<table border=1>";
echo "<tr><td><b>Categorie</b></td><td><b>Datum</b></td><td><b>Omschrijving;</b></td><td><b>Gebruiker_ID</b></td></tr>"; // bovenste regel
if ($resultaat) {
    while ($rij = mysql_fetch_array($resultaat)) {

    echo "<tr>";
    echo "<td>".$rij["Categorie_ID"]."</td>";
    echo "<td>".$rij["Datum"]."</td>";
    echo "<td>".$rij["Probleem"]."</td>";
    echo "<td>".$rij["Gebruiker_ID"]."</td>";
    echo "</tr>";
    }
}
echo "</table>";
mysql_close($db);
?>

You can select the category with this code.

<form method="post" action="<?php echo $_SERVER["../h5/PHP_SELF"] ?>">
`Selecteer een categorie:<select name="categorieid">
<?php
$db=mysql_connect(("localhost","username","password") or die("Kan niet verbinden: ".mysql_error());
mysql_select_db(",$db);

    $sql = "SELECT * FROM Categorie";

    $resultaat  = mysql_query($sql); // voer SQL code uit
    while ($rij = mysql_fetch_array($resultaat)) {
        echo "<option value=\"";
        echo $rij["Categorie_ID"]."\">";
        echo $rij["Categorienaam"]."</option>\n";
    }

mysql_close($db);
?

`

Tried it with this code , it didn’t worked , it did nothing(only showed the categories)

<form method="post" action="<?php echo $_SERVER["../h5/PHP_SELF"] ?>">
Selecteer een categorie:<select name="categorieid">
<?php
$db=mysql_connect("localhost","username","password" or die("Kan niet verbinden: ".mysql_error());
mysql_select_db("",$db);

    $sql = "SELECT * FROM Categorie";

    $resultaat  = mysql_query($sql); // voer SQL code uit
    while ($rij = mysql_fetch_array($resultaat)) {
        echo "<option value=\"";
        echo $rij["Categorie_ID"]."\">";
        echo $rij["Categorienaam"]."</option>\n";
    }

mysql_close($db);

?>

<?php
if ($_POST["knop"]) {
$db=mysql_connect(("localhost","username","password") or die("Kan niet verbinden: ".mysql_error());
mysql_select_db("",$db);

$sql = "SELECT * FROM Probleem";
if(isset($_POST["categorieid"])){
    $cat_id = $_POST["categorieid"];
    //sanitize $cat_id to reduce injection risk here
    $sql .= " WHERE `categorieid_id` = $cat_id"; //use correct column name
}
$sql .= " ORDER BY Datum ASC";
$resultaat  = mysql_query($sql); // voer SQL code uit

echo "<table border=1>";
echo "<tr><td><b>Probleem_ID</b></td><td><b>Categorie</b></td><td><b>Datum</b></td><td><b>Omschrijving;</b></td><td><b>Gebruiker_ID</b></td></tr>"; // bovenste regel
if ($resultaat) {
    while ($rij = mysql_fetch_array($resultaat)) {

    echo "<tr>";
echo "<td>".$rij['Probleem_ID']."</td>";
echo "<td>".$rij['Categorie_ID']."</td>";
echo "<td>".$rij['Datum']."</td>";
echo "<td>".$rij['Probleem']."</td>";
echo "<td>".$rij['Gebruiker_ID']."</td>";
echo "</tr>";
    }
}
echo "</table>";
mysql_close($db);
}
?>
<form name="form1" method="post" action="">
  <input type="submit" name="Zoek" id="Zoek" value="zoek">
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:15:23+00:00Added an answer on June 5, 2026 at 2:15 pm

    unless I’ve completely miss understood the question here:

    when the form is submitted posting the category id to your script, try the following:

    $sql = "SELECT * FROM Probleem";
    if(isset($_POST["categorieid"])){
        $cat_id = $_POST["categorieid"];
        //sanitize $cat_id to reduce injection risk here
        $sql .= " WHERE `categorieid_id` = $cat_id"; //use correct column name
    }
    $sql .= " ORDER BY Datum ASC";
    $resultaat  = mysql_query($sql); // voer SQL code uit
    

    that should then get all your results for that category id, and if its not set, you will get all the results as previously got.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code that has one button that let's me choose an entry
This is my code: Let's say that name is set to john $(#first_table).append($('#second_table').find(tr:contains( +
I'm trying to run this code: let coins = [50, 25, 10, 5, 2,1]
I found out the next issue in this simple code: let () = print_endline
Hi I'm using this code below to let a user draw their signature on
Let's look at this code: IList<IHouseAnnouncement> list = new List<IHouseAnnouncement>(); var table = adapter.GetData();
Let's say I'm doing a code. This code uses kontextua ads <div class=pread> <div
Let us say if I have a Perl module Resounces.pm with this code snippet
I have a curl class, called Curl. Let's presume i have this code: $url
Take this example code (ignore it being horribly inefficient for the moment) let listToString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.