Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. As I said, there is still something wrong with his DB design. The condition of an item is not an attribute of the item. It is more of an item status that should go as an int in the items table tied to a status_options table, IE new, used. same thing with the condition. That is not an attribute, it is a condition status that should also be a key in the items table, IE: fair, poor, good, excellent, etc.., not in the attributes table. Using a clock, attributes would be like analog, digital, round, square, electric, battery operated, pendulum, wind up..etc
  2. One too many joins and you probably want a LEFT join SELECT i.title FROM items i LEFT JOIN item_attributes ia ON ia.item_id = i.item_id WHERE ia.attribute = 'Clock Type' AND ia.value = 'Wall Clock' AND ia.attribute = 'Condition' AND ia.value = 'New' I dont think you need the Clock Type and condition in there. Post your current DB schema. Something still not right. Perhaps more like SELECT i.title FROM items i RIGHT JOIN item_attributes ia ON ia.item_id = i.item_id WHERE ia.value = 'Wall Clock' AND ia.value = 'New' Even still, something wrong there due to your DB design.
  3. Glad your getting some direction, but your latest query is still not right. Your item to attributes should be joined on the item id in both tables, not this "right join select" you have going on. You have THREE querys. You only need ONE. And like I already told you, there are no "Sub Categorys". Everything is a category, Each category is either a parent or a child of another category.
  4. For the best feedback, detail out about the site and the functionality desired and how it should work. Based on your posts, it appears to be some sort of auction application.
  5. Why do you insist on trying to get a bad design to work? Stripped or not, what you have is simply no good.
  6. Just like building a house or a building, you need to have a solid foundation before you hammer the first nail. The place to start right now is getting your database correct and then building upon that otherwise you are just going to have problems down the road
  7. I am going to give a minute for others to chime in, but this DB Schema is just no good. Off hand, a category is a category is a category, just that some have parent categories and others dont. You also have some timestamp issues. `sub_category_id` INT(11) NOT NULL, `sub_sub_category_id` INT(11) DEFAULT NULL, `sub_sub_sub_category_id` INT(11) DEFAULT NULL, Really? Sub sub sub? enum('Town/City','County','Country','Continent','MENA Region','Worldwide') Enum??? You only have one table that has any foreign keys. Not sure if you stripped them out or not. This is just really bad. But dont worry, it will get straightened out on this forum. * I think it would be helpful for you to google shopping cart DB schemas in the images tab.
  8. How about we start at the beginning. Post an SQL dump of your DB so we can make sure your DB is correct. It appears everyone is replying to how YOU think the joins should be done. Give us the DB and the expected output and let us fill in the "How". On a quick glance, it doesn't look right to me.
  9. the a and the C just shortcuts to the table names
  10. Ahh yes, I had that little brain tickle that something was slightly amiss.
  11. I believe you answered your own question. AND (sv.value = 'Alarm Clock' AND s.specific_id = '15') OR (sv.value = 'New' AND s.specific_id = '19')
  12. Surprised you dont know, and yet you are fully aware of it. *PS: What happened to your google? http://xyproblem.info/
  13. Allow me to be the first to ask, why? What are you doing? Sounds a lot like the XY problem
  14. If you used the correct if($_SERVER['REQUEST_METHOD'] == 'POST') you would not have had that problem in the first place. There are other threads in this forum that discuss why not to do it any other way. Depending on the submit button will completely fail in certain circumstances with Internet Explorer.
  15. Your going to have to post more code than that. Show the code for the whole page.
  16. day BETWEEN 1 AND 4
  17. I guess it would help to precisely see the query you are trying to run or the page you get the error on. We are not going to dig through your entire project to find your problem.
  18. if ($_SERVER['REQUEST_METHOD'] == 'POST')
  19. Dont use if(isset($_POST['submit'])) It can fail in certain circumstances in Internet Explorer. Your quotes outside the numbers are messing you up. It is trying to insert a single value as 5,6,7
  20. Why are you putting your connection in a function? All you need to do is require database.php in the pages that need a connection. (Less the function code) And you dont want to output connection error details to the user.
  21. Un Checked check boxes do not submit any data whatsoever.
  22. That is still a mess of duplicate code. DRY: Don't Repeat Yourself. * Still could be improved.
  23. Okay, I guess I am touching this.. Here is a start
  24. I am not even going to touch this except to say that the font tag is deprecated. You need to use the span tag for an inline style. You have about 50% more code than what you need.
  25. Yes, the purpose. The process as seen from outside the code would be helpful. LIke:User clicks button and based on code calculation X number of numbers are displayed to user...... * Where does this array come from?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.