timmah1 Posted December 24, 2008 Share Posted December 24, 2008 I've looked on google for an answer to this since last night, and I can't find any. Can anybody help me out? I need to find everything from the db where a table will equal more than one. I have this $package1 = implode(",", $_POST['pack']); echo $package1; $sql = "SELECT * FROM dailypicks1 WHERE sport = '$sport' AND active = '$active' AND package = '$package1'"; It echo's out properly, but it's not selecting both from the field package. How is this done? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/138335-solved-db-fields-select-more-than-one/ Share on other sites More sharing options...
timmah1 Posted December 24, 2008 Author Share Posted December 24, 2008 Maybe I didn't write that the right way. I need to be able to find everything from the field package, even if it's more than one Link to comment https://forums.phpfreaks.com/topic/138335-solved-db-fields-select-more-than-one/#findComment-723324 Share on other sites More sharing options...
MadTechie Posted December 24, 2008 Share Posted December 24, 2008 $package1 = "'".implode("','", $_POST['pack'])."'"; // string #$package1 = implode(",", $_POST['pack']); // numbers echo $package1; $sql = "SELECT * FROM dailypicks1 WHERE sport = '$sport' AND active = '$active' AND package IN ($package1)"; Link to comment https://forums.phpfreaks.com/topic/138335-solved-db-fields-select-more-than-one/#findComment-723327 Share on other sites More sharing options...
timmah1 Posted December 24, 2008 Author Share Posted December 24, 2008 This give me an error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource The values in question are po, spl I have both of these in the package field Link to comment https://forums.phpfreaks.com/topic/138335-solved-db-fields-select-more-than-one/#findComment-723329 Share on other sites More sharing options...
timmah1 Posted December 24, 2008 Author Share Posted December 24, 2008 nevermind, had something typed wrong. Thank you so much MadTechie Link to comment https://forums.phpfreaks.com/topic/138335-solved-db-fields-select-more-than-one/#findComment-723330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.