Please help with code

What i want to do is match my clients(stored in a datbase) to a property ,i pulled up as a result.Here is my code.The thing is it doesnt match the client and the property properly.Here is my code.Your help is appricated.<?phpmysql_connect("localhost","root","pass123"); mysql_select_db("vap"); $search = $_POST["search"]; $query = "SELECT * FROM propertys WHERE ref LIKE '%".$_POST['search']."'";$result = mysql_query($query);

you are searching to match price field to $_POST['search'] and not $_POST['price'] or something similiar?

Your while loops should specify mysql_fetch_array($result, MYSQL_ASSOC) - because you then use the name of the fields in the database to reference your fields. My memory doesn't remember if it does this automatically or not though...

I was going off the fact that it's acceptable to have put in:
'$var'
to your sql coding without any hiccup, and simply went with that. As it was, I still question whether he was wanting to search only the end of their fields for the search value, or anywhere in there..

My testing box is nt connexted to any server so it doesnt make a dirrence.If i pull up a property i want to match all my clients in another table with that property the foreign key would be price i think?Should i have a min and max price for my clients?

price is a bad choice for foreign key. what if different properties have the same price?

create a new field on your clients table for the id of the property, which matches the property id from the properties table that said client is affiliated with.

as for not escaping.. well, not going to argue but it needs escaping. what happens when you move it to production? Can you absolutely 100% guarantee you won't forget to change it? It's also bad habits to not escape even when you think it's safe.

My testing box is nt connexted to any server so it doesnt make a dirrence.
If i pull up a property i want to match all my clients in another table with that property the foreign key would be price i think?Should i have a min and max price for my clients?

In that case, once you've found your property, I don't quite see where the value of "price" comes from when passing it onto the next php page? You only have a submit button and nothing else (really), but nothing that actually passes the needed variables of price and search onto the next page for processing your next query.

Then when you hit the submit button to pull up your clients, both price and search will have values...
Otherwise it looks like your next search (to find the clients based upon the property you've found) are attempting to match, well, no value as far as i can see - as it doesn't currently exist as a posted variable on that submit button.

The above shows selecting price from the search criteria - but isn't the criteria the price, at which point shouldn't it be the price that is matching the value in the price column?

An alternative, apart from a fixed price, is to have a range for each customer... or a percentage variable of the price instead (ie 200,000 +- 10%, so 180-220,000).
I just added (not sure about syntax on it) the ability to check between two prices based upon the clients stated price, plus or minus 1000.

As I said, don't quite get why you match their price column with your search result... shouldn't it be your search result brings up a price, which customers are then matched against that price?