Jump to content

Help with a QUERY


Canman2005

Recommended Posts

Minase

 

Your code worked spot on.

 

I'm wondering if anyone can help me further this code, basically I want to add another field to the "members" table called "code", so the table would look like

 

ID     NAME     CODE

1      David      A

2      Bob        B

3      Sarah     A

 

and then I want to alter the QUERY so that it only selects members with A in the code field and skips any member with B in their CODE field.

 

Can anyone help?

 

Masssive thanks to everyone who has helped so far

 

Dave

Yep, that seems to do the job until you reach a row which doesnt have that code im asking for.

 

Because you're grabbing the next ID in the sequence, if that ID it returns doesnt equal what im asking then it just displays nothing.

 

If that makes sense?

 

Any ideas?

Just stuck trying to get just the rows of the table "members" that have a particular code, but then auto skipping the ones that dont have that code.

 

it cant work with

 

$return = "SELECT id, name, code FROM members WHERE id = '".$id."' AND code = '' ";

 

because as soon as a row is returned without the correct code you are asking it for, it simply returns an empty row.

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.