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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:32:37+00:00 2026-06-13T01:32:37+00:00

$_POST[‘domain’] is the result of some form’s CHECKBOX with 3 or more values of

  • 0

$_POST['domain'] is the result of some form’s CHECKBOX with 3 or more values of domain (C,C++,Java,etc.), whose value is now saved in an array '$Domain'. Now, I need to select the tuples from my table which are in the same domain as selected by the user in the CHECKBOX.

I tried using FOR loop, but it gave me a T_FOR unexception
error or something. Now I’m trying it with implode function, its not
giving any query error but not showing any result from the query
either! The PROBLEM is within the IN operator of the query. How
can I solve it?

if(isset($_POST['domain']))
    {
        $Domain = $_POST['domain'];
        $search=$_POST['search'];

        $N = count($Domain);

        echo("<p>You selected $N domain(s):<br/><br/> ");
        for($i=0; $i < $N; $i++)
        {
            echo($Domain[$i] . "<br/> ");
        }
        echo("</p>");

        $dom_str="'".implode("', '",$Domain)."'";

    $query ="SELECT * FROM learner_object WHERE(lo_tag1='$search' || lo_tag2='$search' || lo_tag3='$search') AND 
            lo_domain IN ( ".$dom_str." ) ";

    $result =mysql_query($query)
    or die('query failed.'.mysql_error());

      while($row = mysql_fetch_array($result))
        {   
            echo  "<a href=\" ".$row['lo_url']." \" target=\"_blank\" \">"  .   $row['lo_name']  .   "</a> <br/> ";     
            echo $row['lo_desc']."<br/><br/>";      
        }
     }
     else
     echo "<p>You didn't select any Domain.</p><br/>";
  • 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-13T01:32:38+00:00Added an answer on June 13, 2026 at 1:32 am

    Thanks to u all for helping me out. I’ve figured the correct code with all your help.
    Query:-

    $query ="SELECT * FROM learner_object WHERE(lo_tag1='$search' || lo_tag2='$search' || lo_tag3='$search') AND lo_domain IN ( '" . implode("','", array_map('trim', $Domain)) ."' ); ";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$arrayOfEmails=$_POST[arrayOfEmails]; 1st question: $arrayOfEmails is now just an array in JSON notation. How would
I post some data over to another page from a form. It's a shopping
POST requests to server work fine until a file is attached. The form is
POST /api/crmteetimeapi.asmx/Login HTTP/1.1 Host: golffacility.com Content-Type: application/x-www-form-urlencoded Content-Length: length OwnerID=string&UserID=string&Password=string What language do I
Post-release, I have made one small change to one form in our development site
Cross-post http://perlmonks.org/index.pl?node_id=979710 I'm trying to create a text file from some XML using Perl
$op=$_POST['param']; $statement=eval(return ($op);); in 'param', if there is a strange character such letter 'jfsdf'
class Post< ActiveRecord::Base end post_array = Post.first If I want to add some data
first post here on stack overflow, hoping to get some advice on how to
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.