iceblox Posted July 19, 2007 Share Posted July 19, 2007 Hi All, I have a deals database and im trying to exclude rows of data from the database if the "NetworkName" equals "Pay As You Go" the query itself its pretty easier but i just cant get it to do it. Anyone know how to achieve this? $query = "SELECT * FROM deals WHERE Name = '$model1' ORDER BY TotalCost ASC LIMIT 15"; Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 19, 2007 Share Posted July 19, 2007 MySQL provides the <> operator, which means "not equal to": $query = "SELECT * FROM deals WHERE Name = '$model1' AND NetworkName <> 'Pay As You Go' ORDER BY TotalCost ASC LIMIT 15"; Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 19, 2007 Share Posted July 19, 2007 also try and avoid the *(everything) for your fields instead take what you need so you don't over work your db Quote Link to comment Share on other sites More sharing options...
iceblox Posted July 19, 2007 Author Share Posted July 19, 2007 Thanks guys worked a treat! On the same sortof topic when i include my comparison script onto another php page the £ symbol gets turned into a � why does it do this? And is there a fix? Cheers, Phil Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 19, 2007 Share Posted July 19, 2007 the symbol you are talking about can't be interpreted by ASCII encoding i believe you need to use UTF-8 unicode to get it to work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.