glennn.php Posted September 8, 2008 Share Posted September 8, 2008 i don't mind if someone could point me to the right tutorial, but i haven't had any luck finding one for this particular issue (either way, i could use a little help): i've got an array, $offering, which would return something like 03, 04, 08 foreach ($offering as $f) { $deg = $f; echo $deg; // gives me 030408 - fine... } while foreach ($offering as $f) { $deg = $f; } echo $deg; // gives me 08 - so i can only assume that $result = mysql_query("SELECT COUNT(*) FROM administrators WHERE fice IN (SELECT fice FROM characteristics WHERE carnegie_code = '$carn_class' AND offering = '$deg') ") or die(mysql_error()); is only going to return those with fields 'offering' containing 08... can someone please show me how to search for ALL the values for that field...? i really appreciate it... GN Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted September 8, 2008 Share Posted September 8, 2008 If you're asking what I think you are, see this post: http://www.phpfreaks.com/forums/index.php/topic,215379.msg984429.html#msg984429 The query in that post would return rows where the name is either tom,dick or harry. Quote Link to comment Share on other sites More sharing options...
glennn.php Posted September 8, 2008 Author Share Posted September 8, 2008 well, i think it's close - if this returns 030408 and not 03,04,08 $offering = $_GET['highest_deg']; foreach ($offering as $f) { $deg = $f; echo $deg; // gives me 030408 - fine... } that didn't quite work - what am i missing? $result = mysql_query("SELECT COUNT(*) FROM administrators WHERE fice IN (SELECT fice FROM characteristics WHERE offering IN '".join("','",$f)."'") or die(mysql_error()); i don't know how to see the difference in this array $array = array('tom','dick','harry'); and this one $offering = $_GET['highest_deg']; thanks Quote Link to comment Share on other sites More sharing options...
glennn.php Posted September 8, 2008 Author Share Posted September 8, 2008 is this where explode() comes into play... ? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted September 8, 2008 Share Posted September 8, 2008 You were missing a closing parenthesis in your query. Try: $result = mysql_query("SELECT COUNT(*) FROM administrators WHERE fice IN (SELECT fice FROM characteristics WHERE offering IN '".join("','",$f)."')") or die(mysql_error()); As for the array, I assume $_GET['highest_deg'] is the array of values you need to be matching against? Quote Link to comment Share on other sites More sharing options...
glennn.php Posted September 8, 2008 Author Share Posted September 8, 2008 yes, that's the array i was matching against... this did it for me, thanks very much, GingerRobot. Topic Solved... $offering = $_POST['highest_deg']; $offering_sql = implode(',',$offering); $result = mysql_query("SELECT COUNT(*) FROM administrators WHERE fice IN (SELECT fice FROM characteristics WHERE offering IN ($offering_sql)) ") or die(mysql_error()); 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.