ccrevcypsys Posted September 10, 2007 Share Posted September 10, 2007 Exclude certain rows from a database pull? heres my code $genre_query = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE ".$glob['dbprefix']."CubeCart_inventory.customer_id=customer_id AND deleted = 0 AND customer_id="" AND cat_id=".$prodArray[0]['cat_id']." ORDER BY popularity DESC LIMIT 9"); Link to comment https://forums.phpfreaks.com/topic/68709-solved-how-can-i/ Share on other sites More sharing options...
phat_hip_prog Posted September 10, 2007 Share Posted September 10, 2007 Instead of 'SELECT *' use something like 'SELECT var1, var2, etc FROM...' or if using multi tables use tablename.var1 etc Link to comment https://forums.phpfreaks.com/topic/68709-solved-how-can-i/#findComment-345390 Share on other sites More sharing options...
ccrevcypsys Posted September 10, 2007 Author Share Posted September 10, 2007 Well heres the thing. I am trying to make it to when somone views the song info on the page. It will list all from a certain genre and i want to do it without that currently viewed artist. So i need all of the data from the table but i need to exclude the artist (customer_id). Link to comment https://forums.phpfreaks.com/topic/68709-solved-how-can-i/#findComment-345392 Share on other sites More sharing options...
GingerRobot Posted September 10, 2007 Share Posted September 10, 2007 Add something else to your search parameters? $genre_query = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE ".$glob['dbprefix']."CubeCart_inventory.customer_id=customer_id AND deleted = 0 AND customer_id="" AND cat_id=".$prodArray[0]['cat_id']." AND artist != '$current_artist' ORDER BY popularity DESC LIMIT 9"); Obviously, i don't know how you will get the current artist, since i don't know how your page is written. Ive just called the variable $current_artists. You'll need to change that. Link to comment https://forums.phpfreaks.com/topic/68709-solved-how-can-i/#findComment-345393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.