Jump to content

I need help with my select on my search box


ribeiro
Go to solution Solved by requinix,

Recommended Posts

So basically my select is giving me results that I don't want , please take a look at it , if you can help me I would appreciate it thank you. :D

image.png.0c74f7d2e77ebb5bb34613bbe9d10b65.pngimage.png.1c411605bc8fed2c45c99d7a0df8be1f.png

Im searching for something with the letter j in it , be it the user or the nome_proprio row 

image.thumb.png.e29676ed0002f69a5cde3ca03b8ef7ad.png

it gives me this: 

image.thumb.png.602e013fd6c57f906900be8847da54ff.png

heres the code aswell 

image.thumb.png.aaec5645663f8ac0cb4fb3f4fb360750.png

As you can see I just want where user LIKE '$procura' , i had  the ,OR nome_proprio LIKE '$procura' , but it just gives more 

posts come from here :

 

image.png.c9922634fbe2b1a627c5c8f54b65d4fb.png

 

If you need something more like the code itself , i can provide it :D

Thank you for your time and help:D

Edited by ribeiro
Link to comment
Share on other sites

  • Solution

You entered "j" and it's listing records with user containing "j". So I don't see what's wrong with that.

Are you talking about getting all those duplicates? It's because you're joining the login and dados_user tables together without telling MySQL how to join them together.
You need a query that looks like

SELECT login.user, dados_user.nome_proprio
FROM login
JOIN dados_user ON login.??? = dados_user.???
WHERE login.user LIKE '%$procura%' AND login.eliminado = 0

 

  • Great Answer 1
Link to comment
Share on other sites

56 minutes ago, requinix said:

You entered "j" and it's listing records with user containing "j". So I don't see what's wrong with that.

Are you talking about getting all those duplicates? It's because you're joining the login and dados_user tables together without telling MySQL how to join them together.
You need a query that looks like


SELECT login.user, dados_user.nome_proprio
FROM login
JOIN dados_user ON login.??? = dados_user.???
WHERE login.user LIKE '%$procura%' AND login.eliminado = 0

 

Thank you so much it was actually that. I didn't know of JOIN , thank you for intruducing me to it aswell . Thank you so much :D 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.