Hi, I have been left in the lurch with a few php scripts on my site and I'm the first to admit coding is not my strong point! I have managed to fix most of the issues, but I am stuck on the following. Basically, I want to query the same row twice in a multiple query, but having problems figuring it out. This is the code I have;

$query = "SELECT items.iname, grow.name "."FROM items, grow "."WHERE items.iname = grow.name and grow.location='$arch' and items.ownerid='$sid'";

This works fine, (its for a drop-down list), however I want to add to the location to echo rows where location=$arch and also where location=no. I have tried IN but it didn't work. Any help would be appreciated, many thanks.

Member Avatar for diafol
"WHERE items.iname = grow.name AND items.ownerid='$sid' AND (grow.location = '$arch' OR grow.location = 'no')"

Like that?

commented: Helpful answer and solved problem. +2
"WHERE items.iname = grow.name AND items.ownerid='$sid' AND (grow.location = '$arch' OR grow.location = 'no')"

Like that?

Perfect, makes sense when you know the answer! Thank you.

Member Avatar for diafol

Great, please mark as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.