-
Posts
307 -
Joined
-
Last visited
Everything posted by TapeGun007
-
Somehow I clicked submit on accident. I use a "code" because the code is unique to each sales person and is assigned by another database that I have no control over. So instead of using a SalesID, I use a SalesCode, ProspectCode, and TerritoryCode. So the SalesCode must match in the TerritoryCode. In some rare cases I may let a sales person keep a lead that is not in their territory. Here is how the table actually works:
-
Yeah, I realized when I first wrote that .... that it wasn't the ID that needed to match. I get confused sometimes because normally I would match an ID. But the Sales People are assigned a "ReferralCode" that is unique to them already. It really goes like this: Sales | Prospects | | Territories | -------------- ------------------ ----------------- SalesCode
-
Barand, I knew you had to be right, because so far you've ALWAYS been right. I started to debug... it wasn't working because it was ORDER BY p.ProspectBusinessName. Thank you so much!
-
Hi Barand, Just to clarify... in the table "Territories" there is either a Territory (County) AND State set, OR just a Zip code with no State or County set. I checked my "Prospects" table to ensure they all have a "ProspectLastContacted" date that is at least 2 - 4 weeks ago. I tried your code and it give me nothing in return.
-
I attempted this just to see if I could narrow it down. I realize I probably need to join based on State names and not counties. "SELECT * FROM Prospects p LEFT JOIN Territories t ON p.ProspectState = t.TerritoryState OR t.ProspectZip = t.TerritoryZip "; This yields nothing.
-
Here at least one of my attempts at this: SELECT * FROM Prospects p LEFT JOIN Territories t ON p.ProspectCounty = t.Territory WHERE (ProspectCounty = Territory AND ProspectState = TerritoryState) AND DATE(ProspectLastContacted) < DATE(NOW() - INTERVAL 14 DAY) ORDER BY p.BusinessName I won't use * once I get the right code, I realize that's not good. I just realized I forgot to put the OR in there.
-
Prospects --------- ProspectCode ProspectBusinessName ProspectLastContacted ProspectCounty ProspectZip ProspectState Territories ----------- TerritoryID TerritoryCode (Should always match ProspectCode above) Territory (should always be a county name) TerritoryState TerritoryZip I want to join these two tables under these circumstances: ( ProspectCounty = Territory County AND ProspectState = TerritoryState OR ProspectZip = TerritoryZip ) AND ProspectLastContacted was last contacted 2 weeks ago.
-
Good idea, and I do have a timestamp on each note already.
-
This also helped me greatly because I had a misunderstanding about using the WHERE clause with a LEFT JOIN that confused me greatly.
-
EDIT: Yes, this does work. I had posted that it did not, but it was because I didn't realize most of my "contacted" leads in the db were marked as something else.
-
I’ve used SQL for years, but only very simple one table queries. I have two tables Prospect and Notes: Prospects ProspectID ProspectName ProspectCode ProspectStatus … Notes NoteID NoteProspectID Note Here is what I want, but I don’t know how to write it in MySQL All prospects with the following ProspectCode = “123abc” ProspectStatus = “Contacted” I also want only the last Note from Notes where ProspectID = NoteProspectID. I hope this makes sense.
-
I'm fairly new to SQL in general. The SQL calls I have made were always just from a single table and easy. I have two tables: Prospects ProspectID ProspectName .... The other is Notes:
-
I was able to finally figure it out. But I do have a question: Why not use the global variable? I believe you, but if I understand the "why" it will stick better in memory.
-
You still didn't say what the errors are.
-
Here is what I get as an error: object(mysqli_stmt)#2 (0) { } bool(false) Fatal error: Wrong SQL: SELECT * FROM Prospects WHERE ProspectCode = ? Error: in functions/Calendar.php on line 56
-
I have a calendar function. In the function I declared $con and global so it would pass into the function. I have several other pages using this basic format of code that work fine that are not functions... Here is the code that is giving me issues within the CalendarFunction: $Code = $_SESSION['SalesReferralCode']; $sql = "SELECT * FROM Prospects WHERE ProspectCode = ?"; $stmt = $con->prepare($sql); var_dump($stmt); if($stmt === false){ trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $con->error, E_USER_ERROR); } // Bind parameters. Types: s = string, i = integer, d = double, b = blob $stmt->bind_param("s",$Code); $stmt->execute();
-
(not sure what happened, entire post didn't post) Anyway, so I have php code that loops this line because I have a tabular form where you can input up to 5 clients information at a time on a page. <td><input id="phone" name="Phone[]" size="10" maxlength="10"/></td> The issue is that the phone number formatting only works on the first phone input field, and none of the rest. I've tried to research, but I'm a complete noob at Jquery and not sure how to apply this function to an array of input fields.
-
I use this function to simply format a phone number input field on a form. It doesn't allow users to enter anything but numbers and forces the format such as (xxx)xxx-xxxx. Here is the function code: <script type='text/javascript' src='../components/js/jquery.js?ver=1.11.2'></script> <script src="../components/js/jquery.maskedinput.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(function($){ $("#date").mask("99/99/9999",{placeholder:"mm/dd/yyyy"}); $("#phone").mask("(999) 999-9999"); $("#time").mask("99:99",{placeholder:"hh:mm"}); }); </script>
-
I woke up today, looked at the code and realized what I was missing from previous experiments! This works: <?php for ($x = 0; $x <= 10; $x++) { ?> <a href="#popup<?=$x; ?>">Let me Pop up</a> <div id="popup<?=$x; ?>" class="overlay"> <div class="popup"> <h2>Address:</h2> <a class="close" href="#">×</a> <div class="content"> <?=$x; ?> for pop me out of that button, but now i'm done so you can close this window. </div> </div> </div> <? } ?>
-
All of the code above works fine. It's a single pop up window. What if I wanted to use a pop up window for tabular data instead? So say I pull up 10 contacts, and you click a link next to the contact for "John Doe" and his address pops up, but then I click below on to "Jane Doe" and the pop up shows her address instead? How can I accomplish this?
-
Here is my CSS file: .overlay { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, 0.7); transition: opacity 500ms; visibility: hidden; opacity: 0; } .overlay:target { visibility: visible; opacity: 1; } .popup { margin: 70px auto; padding: 20px; background: #fff; border-radius: 5px; width: 30%; position: relative; transition: all 5s ease-in-out; } .popup h2 { margin-top: 0; color: #333; font-family: Tahoma, Arial, sans-serif; } .popup .close { position: absolute; top: 20px; right: 30px; transition: all 200ms; font-size: 30px; font-weight: bold; text-decoration: none; color: #333; } .popup .close:hover { color: orange; } .popup .content { max-height: 30%; overflow: auto; } And here is my HTML <a href="#popup1">Let me Pop up</a> <div id="popup1" class="overlay"> <div class="popup[]"> <h2>Address:</h2> <a class="close" href="#">×</a> <div class="content"> Thanks for pop me out of that button, but now i'm done so you can close this window. </div> </div> </div>
-
No. It's just like I said it is above. "abc_def_ghi" would go to "abc_def_ghi/" If I take even one underscore out, then it loads the php file as if it has the .php on the end. Strange to me. I just replaced the underscores with dashes instead and that works fine. I'm just curious as to why it does this. There is nothing else in my .htaccess except this one line: Options -Indexes to disable directory browsing. Are there any settings in php.ini that might cause this to occur?
-
I don't have a directory with that name. It seems that if I have a file name with two underscores in it, that it thinks it's a directory (even though one doesn't exist). So to explain better if I have http://whatever.com/who_knows_what it automatically goes to http://whatever.com/who_knows_what/ as a folder even though there is no folder with that name. Whereas, if I simply renamed it to who-knows-what and use dashes, it comes up as http://whatever.com/who-knows-what and displays the correct php file and not a directory like http://whatever.com/who-knows-what/
-
Never mind, I sort of figured this out. For whatever reason a file called "create_a_contact" always tries to go to a sub directory. But a filename of "create_acontact" has no issues resolving to "create_acontact.php". I'm not sure why that is. My .htaccess is as follows: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ /$1.php [L,QSA]
-
I used to be able to type in "contacts" and it would load "contacts.php". Something in my webhost over wrote this and now I cannot get it back. I tried several examples online, but instead of opening "contacts.php" it would try to open to "contacts/". Very frustrating! Any help at getting this correct would be greatly appreciated.