Jump to content

Recommended Posts

I'm making a little search script that simply does the following:

 

SELECT * FROM `rscd_objects`

WHERE `object` = '" . $db->escape(trim($_POST['object'])) . "'

OR `x` = '" . $db->escape(trim($_POST['x'])) . "'

OR `y` = '" . $db->escape(trim($_POST['y']))

 

I just searched for '999'9 in $_POST['object'] and got the following results:

 

highscores.jpg

 

Can anyone explain why that's happening? I just want it to select the last entry.

Link to comment
https://forums.phpfreaks.com/topic/186134-search-results/
Share on other sites

your got an OR so it will search in this case

 

1) object = 999

2) x ='' (0)

3) y ='' (0)

 

if anyone of these conditions  are fulfilled it will show the row

 

you should leave out the x and y or change your OR to AND with the proper x and y

Link to comment
https://forums.phpfreaks.com/topic/186134-search-results/#findComment-982986
Share on other sites

Greetings.

 

Yes I agree with the previous statement.  I have some experience in SQL, but my main problems are usually getting all the software and the drivers to work together on my computer.

 

I am using PHPDesigner 7.

I can't connect to MYSql database.

Also php code just doesn't want to run.

 

Here are the screens:

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/186134-search-results/#findComment-983009
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.