Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by jimfog

  1. that did,,,not used to in applying the rules of logic in sql...probably you might say that they no differ from other languages and you would be right....anyway..tnanks.
  2. take a look at this query...it has a series of AND clasues..pay attention to the 3rd commented..it sums up what I want to do. SELECT lastname,city FROM users INNER JOIN business_users ON business_users.user_ID=users.user_ID WHERE users.active=1 AND business_users.sched_entered =1 AND business_users.services_entered=1 --and business.users.staff_entered=1 only if business.users.sraff_enfaged_in_appt=1 AND lastname LIKE 'p%'; I want to ask as prerequisite business.users.staff_entered ONLY if business.users.sraff_enfaged_in_appt column is true. How I would go about achieving that?
  3. unless my provider gives me a static IP..correct?
  4. I know that apache with htaccess offers the choice of allowing access to a site only from one IP. The question is if this has any sense if the allowed IP is dynamic?
  5. Ok...I will put it this way in case I was not specific. The user might put whatever value he/she likes...even values not matching any value from the menu....and he leaves the value there in the input with no selection making....that is undesirable but in the case of autocomplete scenarios we are examining probable..entering a custom value and NOT choosing from the menu. Unless I miss sth in the above logic. In case I confused you sorry...what I am trying to say is that I must find a way to enforce selection..that is the key here.
  6. well...datalist seems to have some browser incosistencies plus the fact that it has the same drawback search like functionality....the user can enter whatever value he likes. The nice thing about select is that the user can only choose from predefined options but that bad thing is that it is not the best solution when a menu has many choices...in my case about 70.
  7. there is one slight problem though with this "search like" feature. The user can enter an invalid value...a value not included in the medical specialties....whereas with a dropdown menu(select tag) he//she can only enter predefined(valid) values. Any workaround to the above problem?
  8. some clarifications.... You said ajax call for the auto complete...kind like a search feature?...keyword is sent w ajax then query echo the results back. When you say to limit the choice....I suppose you mean what is actually seen by the user....the specialties are 65+ one way or the other. The results appearing(the specialties) must reflect the keyword...and when typing a keyword the user will see only the specialties starting from that keyword....which is less than 10. I do not see a problem with that. From the moment he starts typing the keyword in reality he/she never sees 65 options. I hope it is more clear now...what do you think?
  9. My user is a doctor who must choose what medical specialty he/she is..that said choose from 65+ options. So I must use a drop menu here(select tag). Q1:Do you think I sould use an autocomplete feature? Q2:Using an autocomplete feature or not...what do you think is the best implementation for the above scenario? Putting it more simple...how to go about implementing a dropdown list with about 65+ options. I have seen various implementation in the web but confused about which to choose about my use case. Thanks.
  10. that is what I was expecting to hear...many thanks.
  11. I have a container with list items: <fieldset id="column_contai"> <ul> <li>maria</li> <li>anthi</li> <li>Nikos</li> <li>maria</li> <li>anthi</li> <li>Nikos</li> <li>maria</li> <li>anthi</li> <li>Nikos</li> <li>maria</li> <li>anthi</li> <li>Nikos</li> </ul> </fieldset> I want the height to be auto adjusted depending on the content and when it reaches a threshold(PX for example)...hide the rest and display a scrollbar. I know that the last one is a metter of overflow but I do not kbow how to achieve the first feature.
  12. I have a table that stores the hours of the week a business(hair salon for example) is open monday 11:00 to 18:00 tuesday etx so on so on CREATE TABLE `store_open` ( `id` int NOT NULL AUTO_INCREMENT, `b_user_ID` mediumint unsigned DEFAULT NULL, `open_time` time DEFAULT NULL, `close_time` time DEFAULT NULL, `open_time_b` time DEFAULT NULL, `close_time_b` time DEFAULT NULL, `day` tinyint DEFAULT NULL, PRIMARY KEY (`id`), KEY `b_user_ID` (`b_user_ID`), KEY `day_idx` (`day`), CONSTRAINT `day` FOREIGN KEY (`day`) REFERENCES `weekdays` (`dayID`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 the day foreign key refrences this table here..which holds the days of the week, CREATE TABLE `weekdays` ( `dayID` tinyint NOT NULL AUTO_INCREMENT, `days` varchar(45) DEFAULT NULL, PRIMARY KEY (`dayID`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 QUESTION... I must also store the days where the business will be closed...do you think a separate table for that is needed? Which I assume this table will have a foreing key referencing the weekdays table.... OR you think is better to add another column to the store_open table(probably a boolean-closed or no closed) In that last scenario the days that the business will be closed the values of open_time,close_time(see the store open table create statement) will be set to null.
  13. in_array does not search in multi-dimentional arrays...I did found some code to do it though but I avoided after all cause was more complex than the code above. Sorry for the late response.
  14. thanks for the answer,,,I just want your opinion in this code below since I wrote it BEFORE you answer. thanks again $i=0; while($i<count($_POST['services'])){ if(array_search($_POST['services'][$i], array_column($serviceslist, "serviceID"))===false) { echo json_encode('nosuchservice'); return; } $i++; }
  15. I have 2 arrays $_POST['services'][0]);///this is '31'....but it can contain more than one value $serviceslist);...this is a multidimentional array array(1) { [0]=> array(2) { ["service"]=> string(7) "haircut" ["serviceID"]=> int(31) } } I tried the following code....but it does not work and the reason being it assumes that $servicelist is one-dimentional array. if (is_array($_POST["services"])) { $i=0; while($i<count($_POST['services'])) { if ((in_array($_POST['services'][$i],$serviceslist))==false) { $error='nosuchservice'; echo json_encode($error); return; } $i++; } // return; } how can I search in $secviselist for the values contained in $_POST['services']; The above code shoud output true since I do not use the strict paramaeter...31 exists in both. What adjustments I have to make?
  16. I have a JS datetime object such as this. start =Wed Mar 31 2021 09:00:00 GMT+0300 (Eastern European Summer Time) And I am using the localedatestring and localetimestring to format it. var startsend=info.start.toLocaleDateString() + 'T' + info.start.toLocaleTimeString('el-GR', { hour12: false }); I do not undestand why console longing the above will produce a portion of the result date in a hyperlink format...
  17. now...when error callback of ajax request fires I just display a message to the user....but how am I going to be notified for the reason the request failed...I mean me the dev. Of course I have not intention showing technial details to the end user..the aim is that such info(must somehow reach me)..any suggestions?
  18. I want to remove the clickhandler from this element here https://jsfiddle.net/fiddlehunt/gvtLd3e9/40/...a tooltip is attached to it. No jquery is used here..so I must resort to nativeJS...namely removeListener. I know that to use removeListener I must know the method/function used originally in the addeventListener..which I do not. SO...what can I do to remove the listener?
  19. is it possible to access BB view function outside the view definition...inside a jquery click handler for example: Here is a view and a click hendler..the handler is at line 21. I have tried several things before asking here... backbone example
  20. well the code works...I did not expect to work cause I had made some assumptions--which were wrong of course...I have 2 questions though. why not do this with PHP enbedded in the HTML...why resorting to JS...something like this: <div <?php echo ($schedstatus == 1) ? "style='display:none;'" : "style='display:block;'" ?> id="modal">...... I have come to understand that code in a JS file tha resides INSIDE the document on load function...runs after the HTML/document is loaded...that said the modal should be shown(my assumption) and hidden WHEN the code inside the documenton load functions runs. Obviously I miss something but what is that?
  21. I have a textarea form that the user fills to inform why he/she is closing its business...no more than 200 chars. Suppose that he goes to edit that and clicks the cancel button..in such a case whatever he/she has typed must be replaced by the original text. this original text comes from the database and must be available somehwere in the DOM(in case it is needed such as the case of cancel). I was thinking the data attr but for various reasons I do not think you can store there so much text... What are my alternatives?
  22. Depending on a specific value taken from the database....a popup is hidden or shown in a page. The htlm of the popup is there but when the value is true(that comes from the db) with jquery I hide it. That is I get the value in JS....the problem with this approach is that(in case the popup is to be hidden) on page refresh the popup appears for less that a second and then disappears. Bad for UX. How I could make it that when the popup is hidden does not appear at all on refresh. Iis it better maybe to handle it server-side? I hear opinions.
  23. jimfog

    mvc or no mvc

    I am not coding based on MVC...my progect is not big...it works though..ok it is not the cleaner solution...but I am in a tight schedule...is there a compelling reason to change the code to MVC...what do you think?
  24. I am building an app where a table holds business users-businesses data: CREATE TABLE `business_users` ( `crID` mediumint unsigned NOT NULL, `bus_user_type` smallint DEFAULT NULL, `pack_selected` smallint unsigned NOT NULL, `sched_entered` tinyint(1) DEFAULT NULL, PRIMARY KEY (`crID`), KEY `fk_business_users_buz_usertype1_idx` (`bus_user_type`), KEY `pack` (`pack_selected`), CONSTRAINT `fk_business_users_buz_usertype1` FOREIGN KEY (`bus_user_type`) REFERENCES `buz_usertype` (`Type_id`), CONSTRAINT `fk_business_users_users1` FOREIGN KEY (`crID`) REFERENCES `users` (`user_ID`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pack_fk` FOREIGN KEY (`pack_selected`) REFERENCES `packages` (`package_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 In the table above I have ommited some columns for brevity reasons. As you see there is a bus_user_type column....a business user might be for example a doctor a hair stylist a car shop....etc The doctors are a special case cause I must also store theri specialty(dentist,cardioloist etc)....for this reason I have concluded to the following sheme-tell me what you think: CREATE TABLE `doctors_specialties` ( `business_users_crID` mediumint unsigned NOT NULL, `medical_specialties_specialty_ID` tinyint NOT NULL, `speci_ID` mediumint NOT NULL AUTO_INCREMENT, PRIMARY KEY (`speci_ID`), KEY `fk_doctors_specialties_business_users1_idx` (`business_users_crID`), KEY `fk_doctors_specialties_medical_specialties1_idx` (`medical_specialties_specialty_ID`), CONSTRAINT `fk_doctors_specialties_business_users1` FOREIGN KEY (`business_users_crID`) REFERENCES `business_users` (`crID`), CONSTRAINT `fk_doctors_specialties_medical_specialties1` FOREIGN KEY (`medical_specialties_specialty_ID`) REFERENCES `medical_specialties` (`specialty_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CREATE TABLE `medical_specialties` ( `specialty_ID` tinyint NOT NULL, `specialty_name` varchar(45) DEFAULT NULL, PRIMARY KEY (`specialty_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 In the two above tables I probably must change their names…also see a diagramm of the above tables. diagramm link
  • Create New...