Canman2005 Posted August 4, 2008 Author Share Posted August 4, 2008 afraid it still returns a row with a EMPTY value for some reason, not sure why my little mod seems to have solved it thanks for all your help Quote Link to comment Share on other sites More sharing options...
Minase Posted August 4, 2008 Share Posted August 4, 2008 weird oh well if it works is good Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 4, 2008 Author Share Posted August 4, 2008 Thanks again Minase Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 6, 2008 Author Share Posted August 6, 2008 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 Quote Link to comment Share on other sites More sharing options...
Minase Posted August 6, 2008 Share Posted August 6, 2008 $select = mysql_query("SELECT * FROM scores ORDER BY ID DESC LIMIT 1"); change that to $select = mysql_query("SELECT * FROM scores ORDER BY ID DESC WHERE code = 'A' LIMIT 1"); its just 10 in the morning here,just waked up.hope it works Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 6, 2008 Author Share Posted August 6, 2008 Thanks Minase The problem is that the code is held in the table "members" and not "scores", therefore that QUERY wouldn't be able to find the field code. Do you have anything else up your sleve you maybe able to advise on? Thanks Quote Link to comment Share on other sites More sharing options...
Minase Posted August 6, 2008 Share Posted August 6, 2008 $return = "SELECT id, name, code FROM members WHERE id = '".$id."' AND code = '' "; should work dont know. about what you wrote me in PM deppend what it is cause i already have my projects. Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 6, 2008 Author Share Posted August 6, 2008 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? Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 6, 2008 Author Share Posted August 6, 2008 If the code doesnt exist on the row it's returning I guess it almost needs to skip that row and move onto the next, but the mods i've tried have not worked yet. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 6, 2008 Share Posted August 6, 2008 Just reading this long thread now... where do things stand? Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 6, 2008 Author Share Posted August 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 6, 2008 Share Posted August 6, 2008 Auto-skipping? What does that mean? 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.