Jump to content

TapeGun007

Members
  • Content Count

    290
  • Joined

  • Last visited

Community Reputation

2 Neutral

About TapeGun007

  • Rank
    Advanced Member
  • Birthday 12/11/1968

Profile Information

  • Gender
    Male
  • Location
    San Diego, CA
  1. TapeGun007

    Auto Insert based upon value

    Is it better or are you able to auto insert a percentage based upon a value. Example: Tech1 sells a $1,000 referral item and gets 5% commission Tech1 sells a $2,500 referral item and gets 7% commission instead. I know I could code this in php no problem. I'm just wondering if this makes sense or if it's possible just to auto insert either 5% for under $2,500 or 7% if the sale is equal or over $2,500. There is only 5% and 7%, no other options. The sale amount is stored in the same table.
  2. TapeGun007

    Finding Past Due Dates

    New question related to this. So... when a new prospect is created, the database inserts an automatic value of null. But then I set a follow up date and then when that date passes, I need to reset that value to a null. I simply put if $followupdate !isset then $followupdate = null; But when $followupdate is written to the database, it is now "0000-00-00" and I cannot seem to get the value back to null in mySQL. Everything works fine the way I have it, but call me OCD.
  3. TapeGun007

    Finding Past Due Dates

    Ah, I probably got some bad information in my reading, but I was under the perception that when the date is set to 0000-00-00 it is considered a NULL. This, of course, did not make sense to me. In my testing just now, I see the NULL value when auto inserted by mySQL. Thanks.
  4. TapeGun007

    Finding Past Due Dates

    Ah nvm, I got it unless there is a better way to write this, I would be interested. SELECT * FROM Prospects WHERE UserID = ? AND FollowUpDate < ? AND FollowUpDate > '0000-00-00'
  5. TapeGun007

    Finding Past Due Dates

    mySQL Server Version 5.7.23
  6. TapeGun007

    Finding Past Due Dates

    Not all items in my database have a due date. I already have a page that lists everything that is due today and that's fine. What I want to do is sort out all of the null dates "0000-00-00" but list the overdue items (past today) and not the current due dates (today's date). This was my failed attempt: $stmt = $pdo->prepare('SELECT * FROM Prospects WHERE UserID = ? AND FollowUpDate IS NOT NULL AND FollowUpDate < ?'); $stmt->execute([$ID,$today]); The above will list all the dates that are null anyway. I can't seem to figure out how to write this correctly. Thanks.
  7. TapeGun007

    Adding

    Uh... thanks benanamen. Heheh. I kept searching, reading, and finally found the solution: $stmt = $pdo->prepare("SELECT SUM(Price) AS sumprice FROM Deals"); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); echo $row['sumprice'];
  8. TapeGun007

    Adding

    This might be more of a mySQL question or a PHP question, I'm not exactly sure. I have a field in my table (Deals) called "Price". All I want is the sum of that field. I tried using something like: $price += $row['Price']; This ended up as one long string, even though the database is set as a decimal number field. Then I tried doing it from mySQL like this (from what I read), but I don't think I have the full answer: foreach($stmt->query('SELECT SUM(Price) FROM Deals') as $row) { echo "<tr>"; echo "<td>Total</td>"; echo "<td> ->".$row['SUM(Price)']."</td>"; echo "</tr>"; } Anyway, if someone could just show me how to get that sum, I would greatly appreciate it because I am missing something here.
  9. TapeGun007

    Framework Recommendation

    Just curious, but is it better to use a php framework say like Laravel than coding just plain php? And which framework do you recommend? I've read several websites that suggest Laravel is the better one but who knows who really posted that, so ... just curious from some real dev's what they prefer.
  10. TapeGun007

    Can you update multiple db's?

    I know you can query multiple DB's using UNION, but can you also UPDATE multiple db's, is that even possible? Not something I really want to do, but I'm trying to work around what I inherited until we hire internal dev's to fix this.
  11. Ask your web host. I have been able to keep documents outside of my "www" folder with some web hosts, and others I had no choice but to store it in a sub folder. One simple thing you can do, is let's say you have your www/production/ folder, simply put a blank file in that folder as index.html and you cannot use a web browser to peruse the other files.
  12. TapeGun007

    Form Re-Submission?

    Oh I see... ok thanks.
  13. TapeGun007

    Form Re-Submission?

    I believe this would be a JS question, but I could be wrong: I query a database, it creates a table with all the matches, and then I click "Edit" next to one of the matches which passes an id so I can edit the user info. However, if I click 'Back' in the browser, I get the usual Is there a way to create a back button that would basically resubmit that form or is that even possible? Yes, I don't want to have to re-click "refresh" to populate the form again. Call me lazy, I don't care.
  14. TapeGun007

    CSS Active Dropdown

    Ah. Dadgum it, I really worked hard trying to figure out the error on my own. Now I understand. I had thought about that, but what I also misunderstood is that the last CSS code always overwrites the first CSS code... which apparently is NOT true. But yes, that fixed it, and I'm very grateful for all your help!!!! I feel like you really went the extra mile on this.. and it's very much appreciated.
  15. TapeGun007

    CSS Active Dropdown

    Hi Psycho, I already changed the color back to #99000 (I was just testing to see what that did). This is not the issue. The *ONLY* difference between your picture and my picture is that under the "drivers" menu option (set to active), you have a background of #f6f6f6 (for "add driver" and "search drivers") and I have background color of #99000. This is what I'm trying to understand. I thought maybe it was a browser issue, but I tried this in Chrome, Firefox, and Edge all with the same result. Here is my entire code: <?php //definition of available menu $menuLinks = array( 'Home' => array( 'href' => 'Home.php' ), 'Territory Manager' => array( 'href' => 'tms.php', 'children' => array ( 'Add TM' => '#', 'Search TM' => 'search.php?search=TM' ), ), 'Sales' => array( 'href' => 'sales.php', 'children' => array ( 'Add Sales Person' => '#', 'Search Sales' => 'search.php?search=sales' ), ), 'Drivers' => array( 'href' => 'testcss.php', 'children' => array ( 'Add Driver' => '#', 'Search Drivers' => 'testcss.php' ), ), 'Passengers' => array( 'href' => 'passengers.php', 'children' => array ( 'Add Passenger' => '#', 'Search Passengers' => 'search.php?search=passengers' ) ) ); //Function to create html content for menu function createMenu($menuLinks, $webpage=false) { $menuLinksHtml = ''; foreach($menuLinks as $parentLabel => $parentLink) { //Determine link if parent is active or not $active = ($webpage == $parentLink['href']) ? ' active' : ''; $menuLinksHtml .= "<li class=\"dropdown{$active}\">\n"; //Determine if parent link has children if(!isset($parentLink['children'])) { //No child elements $menuLinksHtml .= "<a href='{$parentLink['href']}'>{$parentLabel}</a>\n"; } else { //Has child elements $menuLinksHtml .= "<a href=\"javascript:void(0)\" class=\"dropbtn\">{$parentLabel}</a>"; $menuLinksHtml .= "<div class=\"dropdown-content\">\n"; foreach($parentLink['children'] as $childLabel => $childLink) { $menuLinksHtml .= "<a href=\"{$childLink}\">{$childLabel}</a>\n"; } $menuLinksHtml .= "</div>\n"; } $menuLinksHtml .= "</li>\n"; } //Return HTML content return $menuLinksHtml; } ?> <!DOCTYPE HTML> <html> <head> <!-- <link rel="stylesheet" type="text/css" href="components/css/rs.css"> --> <style> /***** Begin Menu CSS *****/ ul { width: 100%; list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } li { float: left; } li a, .dropbtn{ display: inline-block; font-size: 15px; color: white; text-align: center; padding: 14px 16px; text-decoration: none; border-right: 1px solid #bbb; } /* Color of the main menu text when hovering */ li a:hover { background-color: red; } /* Once the mouse has moved off the main menu button and is now highlighting a sub menu button, this defines what that main menu button color is */ .dropdown:hover{ background-color: red; } /* Color of main menu button when not selected */ .dropbtn { background-color: 333; } li .dropdown { position:relative; display: inline-block; } li:last-child { border-right: none; } .dropdown-content{ display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 5px 7px 5px 0px rgba(0,0,0,0.2); z-index: 1; } /* Links inside the dropdown */ .dropdown-content a{ color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; background-color: #f6f6f6; /* Sets background color of the drop down menu (not selected) */ } /* Change color of dropdown links on hover */ .dropdown-content a:hover {background-color: #ccc} .dropdown:hover .dropdown-content{ display: block; } /* I have no idea what this does as it appears nothing... li a:hover:not(.active) { background-color: #blue; } */ li.active a { background-color: #990000; } .active dropdown-content{ display: none; position: absolute; min-width: 160px; box-shadow: 5px 7px 5px 0px rgba(0,0,0,0.2); z-index: 1; } .active dropdown-content a{ color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } li.active a.dropbtn { background-color: #990000; } /***** End Menu CSS *****/ </style> </head> <body> <ul> <?php echo createMenu($menuLinks, "testcss.php"); ?> </ul> </body> </html>
×

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.