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 7661147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:33:34+00:00 2026-05-31T13:33:34+00:00

I have 2 questions. One is if there is any error in this code.

  • 0

I have 2 questions. One is if there is any error in this code.

The 2nd question I want to ask is how do you know which <li> item is selected. Right now, the code performs a search in mySQL for all rows that matches city, language and level and returns the results in a list item.

I want it so that when the user clicks on anyone of the list items, it will goes into another page displaying a more detail description by querying the selected list item.

I have a guess, which is for step 2, I also grab the ID (primary key) for each row and somehow keep that stored within the list but not echo.. Would I need to wrap <a> in <form action="XX.php" method="get">?

<?php
        //1. Define variables
        $find_language = $_GET['find_language'];
        $find_level = $_GET['find_level'];
        $find_city = $_GET['find_city'];

        //2. Perform database query
        $results = mysql_query("
            SELECT name, city, language, level, language_learn, learn_level FROM user 
            WHERE city='{$find_city}' && language='{$find_language}' && level='{$find_level}'", $connection) 
            or die("Database query failed: ". mysql_error());

        //3. Use returned data
        while ($row = mysql_fetch_array($results)){
            echo "<li>";
            echo "<a href=\"#result_detail\" data-transition=\"flow\">";
            echo "<h3>".$row["name"]."</h3>";
            echo "<p>Lives in ".$row["city"]."</p>";
            echo "<p>Knows ".$row["level"]." ".$row["language"]."</p>";
            echo "<p>Wants to learn ".$row["learn_level"]." ".$row["language_learn"]."</p>";
            echo "</a>";
            echo "</li>";}
    ?>
  • 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-05-31T13:33:35+00:00Added an answer on May 31, 2026 at 1:33 pm
    1. Your code looks alright from what I can see. Does it not work?

    2. One way would be to get the ID through your SQL-query as well and then add the id to the href in your link. Then you can fetch it through the querystring on the other page, to display the proper post depending on which li-element the user clicked on:

      echo "<a href=\"details.php?id=". $row["id"] ."\" data-transition=\"flow\">";
      

    Not sure how you mean “somehow keep that stored within the list but not echo” – it wouldn’t be possible to store anything in the list, if it is not echoed, as it then wouldn’t be sent to the client. You can of course store the id in a data-attribute on the li-element, which won’t be displayed to the user. It will however be visible through the source code! Don’t know why that should be a problem though?

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

Sidebar

Related Questions

Hey guys, one more quick question for any experts out there. I have a
I know this one is the weirdest of all weird questions I have asked
I know that there are other questions that deal with this error, but those
Similar questions to this one have been asked but none seem to address my
So this was one of my very first questions here, but I have a
I have a relatively simple form which asks a variety of questions. One of
There are a lot of questions concerning this issue, but I don't believe any
I know there have been similar questions posted but I think the issue I'm
Here's another one of these LinqToSQL questions where I'm sure I must have missed
I have a query that pulls up questions from one table and answers from

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.