Jump to content

php / MySQL SELECT Double argument


Fsoft

Recommended Posts

Hey Friends,

 

Well I have a database and a table into it,

 

The table have 4 fields, name, surname, country , idnumber, status!

 

NOW ID NUM is int and auto inrement and all others are Vachars.

 

This table have ten entries inside of it, but the problem is that there are 8 entries simliar,

 

but in that , all the 8 names are same Ali, but in four the country is set to be India and in other it's set to be pakistan, but 6 of them have a status of V.I.P.

 

Now the problem is , if I run a query saying "SELECT name from member where country = pakistan"; it will grab out all the names which corespond to Pakistan and they have three V.I.P and a normal person...there.

 

But the problem is I want to run something "SELECT name from member where country = "Pakistan" & status = "V.I.P";

 

in this sense it will only show me up 3 Alis from paksitan who are V.I.P and fouth one will be not shown to me,

 

But WHERE doesn't work with double condition , not for me with the code I wrote above, I might made some mistake,

 

Please help me I want somethign to be like this "Select somthing from table where condition1 = something & condition2 = something;

 

Hope I made it clear enough,

 

Please help, thanks a lot,

FAISAL!

Link to comment
https://forums.phpfreaks.com/topic/132224-php-mysql-select-double-argument/
Share on other sites

In PHP it's &&.

 

 

In MySQL, it's AND.

 

"SELECT name from member where country = "Pakistan" AND status = "V.I.P";

 

 

Edit:  Hrmmm, actually I've just always seen/used AND.  I guess && works too.  (Gonna either test or google it in a second.)  I had assumed he was talking about in PHP, but perhaps I shouldn't assume ;p.

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.