Jump to content

Search Results


Kryptix

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.