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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:19:05+00:00 2026-06-14T12:19:05+00:00

I have the below code and it works well. However, I am limited to

  • 0

I have the below code and it works well. However, I am limited to search two rows only. I want to search another two rows (total 4 rows). I have tried several techniques but I couldn’t get it working. Sometimes I get duplicated results.

<?php

$term = $_POST['term'];

$connect = new mysqli("localhost", "root", "hala3ammi", "phprealty");

$sql = "
 SELECT phprealty_property.*, phprealty_prop_img.p_id, phprealty_prop_img.fn
 FROM phprealty_property
 INNER JOIN phprealty_prop_img
 ON phprealty_property.id = phprealty_prop_img.p_id 
 WHERE phprealty_prop_img.def='1' 
 AND (phprealty_property.title like '%$term%'
 OR phprealty_property.full_desc like '%$term%')";

$query = mysqli_query($connect, $sql) or die (mysqli_error());

$result = mysqli_query($connect, $sql);

$found = mysqli_num_rows($result);

echo '<br/> Search result(s): '.$found;

while ($row = mysqli_fetch_array($result)){
$img = $row["fn"];
$thumb = 'th_' . $img;
$duh = '<img src="../falcon/listImgs/' . $thumb . '" />';
echo '<br/> Title: '.$row['title'];
echo '<br/> Price: '.$row['price'];
echo '<br/> Type: '.$row['type'];
echo '<br/> Image: '.$duh;
echo '<br/> Full Desc: '.$row['full_desc'];
echo '<br/><br/>';
}
?>

Database:

phprealty

Table where I want to search:

phprealty_property

The INNER join is meant for retrieving default thumbnails from the below table.

phprealty_prop_img

WHERE phprealty_prop_img.def='1'

Thank you in advance.

  • 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-14T12:19:06+00:00Added an answer on June 14, 2026 at 12:19 pm

    I think the reason you might be getting results which appear to be duplicate is your inner join. If you have n rows in phprealty_prop_img that correspond to a single property listing in phprealty_property, (ie n rows in phprealty_prop_img with the same value p_id) then you will get n rows returned by your query, each one with identical information drawn from phprealty_property and only varying in phprealty_prop_img.fn. Task a look at the inner join example given on the W3C site http://www.w3schools.com/sql/sql_join_inner.asp

    As to searching by phprealty_property.city & phprealty_property.short_desc, I don’t understand the problem. Why can’t you just add these into the OR clause at the end this this?

    AND (phprealty_property.title like '%$term%' 
          OR phprealty_property.full_desc like '%$term%' 
          OR phprealty_property.city LIKE '%$city%'
          OR phprealty_property.short_desc LIKE '%$term%')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code below which works, but I want to insert values
I have to code below - works great in IE and Opera, but does
The code below works great. I have a MySQL database that contains book titles
I have a problem sending POST request with VB6. The code below works properly
The code I have below works fine but I'm sure it could be more
I have the code below, which works fine it can be viewed for an
Below is the code I have for sending email which works great. /* *
In the code below I have 2 divs, each having two nested divs. When
I have this below code and it work fine header (content-type: text/xml); $xml =
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which

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.