Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Posts posted by benanamen

  1. Tabs are tabs. From Mobile on up tabs will still act like tabs. If you want an accordion use the accordion. If you want the tabs to magically become an accordion, bootstrap doesn't do that. You would probably have to use some JavaScript to hide the tabs and replace it with an accordion. If you know of a site that behaves the way you want post it here and I may be able to help you figure out how it's done.

  2. Well the OP didn't ask for opinions on his db setup, and didn't post any information about his db structure,

     

    Yeah, that's the thing with noobs (Don't mean it in a bad way), they don't know what to ask or provide. It the typical XY problem. http://xyproblem.info/

     

    OP sees a particular problem and asks how to fix that problem not realizing it is just a symptom of the real problem.

     

    My experience says there is a very high probability that the DB structure is wrong which is why I asked the OP to provide it. I am sure you would agree that the DB is the first thing to ensure is correct and if not to fix that first.

  3. @Zane, the if is just a quick fix band-aid for what is pretty clearly a bad database design.

     

     

    @wkilc, if your wanting to get things done correctly, post your DB schema and we will help you get this right from the ground up. Your Database is the foundation on which you will write all your code. If that is not right, the code you build on it will not be right and you will continue to run into unnecessary problems.

    • Like 1
  4. If you have a properly normalized database with one table with a list of car names you shouldn't have any empty rows. You would also want to be using the ID of the car name not the actual name itself for the value. Additionally, the file name does not belong in the value.

  5. Oh where to start...

     

    You are using obsolete code that has been completely removed from Php.

    Hiding errors with the @ is a no-no.

    If you have School1 and School2 in your DB, your database is wrong and needs to be re-worked.

    You are directly injecting user supplied data into your code and open for an attack

     

    In short, your database and your entire code needs to be re-written.

     

    Look up and learn Database Normalization and study this PDO Tutorial https://phpdelusions.net/pdo

     

    What you have is junk and dangerous and should not be used whatsoever.

  6. Found the problem. In the schedule table, a lot_id can be there more than once. Mysql is using the last rows schedule_date to calculate. I will have to add one more piece of criteria to use the correct row.

     

    @Kicken, thanks for your help.

  7. Thanks @kicken.

     

    That has me on my way. It did update many records but there are many where the datediff is not correct. I even deleted all the order_by_dates and ran the UPDATE and it still creates some dates that are not the correct difference. I even hard coded the days to subtract 21 days from schedule date. I am getting dates from -67 to 432 days difference. Very confused.

     

    I broke down the update query to as simple as possible and still same result. Using:

    UPDATE lot AS l
    LEFT JOIN `schedule` AS s ON s.lot_id = l.lot_id
    SET l.order_by_date = DATE_SUB(s.schedule_date,INTERVAL 21 DAY)
    
  8. I have an order_by_date date field that is generated based on a schedule_date. The order_by_date is the schedule_date minus days_to_order.

     

    Bad data got in order_by_date so I want to update order_by_date in all rows. The following query will show me what the correct order_by_date should be. How do I take the result correct_order_by_date and update order_by_date with that value?

     

    *** As I was writing this, it occurred to me a calculated date does not need to be stored in the DB, nevertheless, I would still like to know the technique to do this. See Attached image

    SELECT
    DATE_SUB(s.schedule_date, INTERVAL d.days_to_order DAY) AS correct_order_by_date,
    l.order_by_date,
    s.schedule_date,
    d.days_to_order
    FROM
    community AS c
    LEFT JOIN block AS b ON b.community_id = c.community_id
    LEFT JOIN lot AS l ON l.block_id = b.block_id
    LEFT JOIN `schedule` AS s ON s.lot_id = l.lot_id
    LEFT JOIN days_to_order AS d ON c.days_to_order_id = d.days_to_order_id
    WHERE
    s.reschedule_date IS NULL AND
    l.order_by_date IS NOT NULL AND
    l.lot_type_id > 2 AND
    s.schedule_date IS NOT NULL AND
    c.community_type < 3 AND
    l.active = 1 AND
    l.order_by_date > s.schedule_date
    

    post-179806-0-59008600-1467945719_thumb.jpg

  9. Eric, I have done a quick review of the code in that script. Get your money back and don't use it. There are several serious security issues with it. One of the more glaring ones is that it uses MD5 or SHA256 for password encryption. It will also output the exact server error messages directly to the user providing valuable information to a hacker.

  10.  

     

     In fact, there are likely activities you may want to track that have no hash as part of that activity. E.g. unsuccessful logins.

    Funny you should say that. I already do that. It is part if the login script that I have not posted. I log all login attempt statuses, good or bad, what the bad user and pass was and IP and datetime.

     

    As I think about it, it wouldnt take much modification to track just the reset data. Table is already there, just need to remove the hash and expiration columns and put them in the users table. 

×
×
  • 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.