ccrevcypsys Posted September 5, 2007 Share Posted September 5, 2007 I know i should be posting this in mysql or something but there is no one there so ya... so im having a problem getting this syntax to work properly what i am trying to do is display the top 15 songs and when u scrollover the links of the song names that are pulled from the db it shows a title that displays there first and last name along with price pop and album name. all of these are in the same table except for firstName and lastName these are in the customer table. its like this cc_CubeCart_customer = firstName lastName cc_CubeCart_inventory = popularity, albumName, image, name, price here is the code i have made so far $popularProds = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE deleted = 0 ORDER BY popularity DESC LIMIT 15"); This does not have the firstName and lastName so here is the one i tried but it messed the order up and just showed the same song over and over again $popularProds = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory JOIN ".$glob['dbprefix']."CubeCart_customer WHERE deleted = 0 ORDER BY popularity DESC LIMIT 15"); Quote Link to comment https://forums.phpfreaks.com/topic/68094-solved-database-pull-problems/ Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 Did you try $popularProds = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory, ".$glob['dbprefix']."CubeCart_inventory WHERE deleted = 0 ORDER BY popularity DESC LIMIT 15"); That might return too many results, I'm not sure. Quote Link to comment https://forums.phpfreaks.com/topic/68094-solved-database-pull-problems/#findComment-342270 Share on other sites More sharing options...
ccrevcypsys Posted September 5, 2007 Author Share Posted September 5, 2007 well did u mean $popularProds = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory, ".$glob['dbprefix']."CubeCart_customer WHERE deleted = 0 ORDER BY popularity DESC LIMIT 15"); because this is what that one does and they all have random names. it should look like this with the names of course in the yellow thing... i dont understand this well enough to even guess. Quote Link to comment https://forums.phpfreaks.com/topic/68094-solved-database-pull-problems/#findComment-342282 Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 What field in the customer table can you match to the inventory? Are you just going by the row? You have to compare something, usually. Quote Link to comment https://forums.phpfreaks.com/topic/68094-solved-database-pull-problems/#findComment-342290 Share on other sites More sharing options...
ccrevcypsys Posted September 5, 2007 Author Share Posted September 5, 2007 customer_id is in both of the tables. how would i go about that? Quote Link to comment https://forums.phpfreaks.com/topic/68094-solved-database-pull-problems/#findComment-342292 Share on other sites More sharing options...
ccrevcypsys Posted September 5, 2007 Author Share Posted September 5, 2007 is this closer? $popularProds = $db->select("SELECT popularity, albumName, price, name, image FROM ".$glob['dbprefix']."CubeCart_inventory WHERE customer_id = (SELECT * FROM ".$glob['dbprefix']."CubeCart_customer) deleted = 0 ORDER BY popularity DESC LIMIT 15"); Quote Link to comment https://forums.phpfreaks.com/topic/68094-solved-database-pull-problems/#findComment-342299 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.