Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

About F1Fan

  • Birthday 04/29/1979

Profile Information

  • Gender
    Male
  • Location
    Lehi, UT

F1Fan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. One other thing: will what you suggested throw a warning or a fatal error if it takes longer than the prescribed time limit?
  2. Hmm, that's a good start. The problem is that the DBs are PostgreSQL (critical), Oracle, AS400 (DB2), and MS SQL (which is the reason this isn't posted in a specific SQL board). PostgreSQL and Oracle use pgsql and oci8 MDB2 drivers, and the AS400 and MS SQL use odbc. I'm looking to see if there's an equivalent for each of those connections, but if you know and could tell me before I can search for it, that'd be cool!
  3. I have a site that connects to several databases. One is a critical connection, but the others are just for some non-essential reports. The problem is that when those secondary DBs are having issues, the entire site slows to a crawl. So, what I'd like to do is attempt to connect to all the DBs, but put a time limit on those that aren't essential. If the connect function for any of those DBs takes too long, kill that function and move on. Any ideas?
  4. jesirose is right, number_format is your best bet, but that will only answer the second question. It will round and display X number of decimals. As for displaying the zero to the left of the decimal, that you'll have to get creative. This should do it: $number = 0.3; list($leftOfDecimal, $rightOfDecimal) = explode('.', round($number, 3)); if ($leftOfDecimal == 0){ echo '.' . str_pad($rightOfDecimal, 3, STR_PAD_RIGHT); } else{ echo number_format($number, 3, '.', ','); }
  5. You'll have to do some bread-crumbing to follow the steps of the user so if they try to navigate backwards, you can retrace their steps.
  6. You're gonna have to list more code. But, just going off of what you said, you need to strip the slashes, then escape the data before inserting.
  7. Sorry, I had to change/remove quite a bit to make it generically usable, and in doing so forgot to change a few things and mention a few things. The getURLString() function will extract the variable string after the page. For example, if the URL was index.php#variableOne=something&variableTwo=somethingElse, this function will return variableOne=something&variableTwo=somethingElse. Using that, you should be able to extract those variables and their values. As for the checkForURLUpdates() function, and the reference to the checkForFeatureActionUpdates() function, that should have been like this: function checkForURLUpdates(){ var currentLocation = window.location.href; if (previousURL != currentLocation){ // do stuff } setTimeout("checkForURLUpdates()",1000); } Then, the checkForURLUpdates() function should be called when the page initially loads. Finally, I'll explain better how they all relate to each other. First, the checkForURLUpdates() function should be called on page load. That will set off the chain reaction that will catch the URL changes. You'll want to put whatever functions you want to occur when the URL has changed where I put "// do stuff." You'll have to write new custom functions here. You'll also use the getURLString() function to extract those variables and use your Ajax stuff to direct the user to the desired page. Second, whenever you change something with your Ajax calls, you'll need to update the URL with the new variables with this piece of code: top.location = "index.php#variableOne=something&variableTwo=somethingElse"; previousURL = top.location; So, let's cover an example. Let's say the initial page is "index.php" and the user hasn't done anything. But, you have an Ajax call on page load, and that changes the URL to something like "index.php#stage=1." Then the user does something that makes another Ajax call. That changes the URL to "index.php#stage=2." One more time and the URL becomes "index.php#stage=3." Each time Ajax is called, you update both the actual URL and the global JavaScript variable "previousURL" to the new URL. Meanwhile, the checkForURLUpdates() function is constantly comparing the actual URL to that previousURL variable. That function isn't doing anything yet, because those two match. But, then the user clicks the back button. That changes the URL from "index.php#stage=3" to "index.php#stage=2," while the previousURL still equals "index.php#stage=3." This is where the checkForURLUpdates() function catches that difference and goes to work. At this point, your code will need to know what to do when the URL variable string is "stage=2" and act appropriately to give the user the page that matches stage 2. Does that help?
  8. I had this same problem, and I found a solution that works for Firefox and IE, but I have yet to find a Web-kit (Safari, Chrome) solution, mainly because it hasn't been a priority. If anyone can expand on my idea to work with Webkit browsers, I'm all ears. Here's how it works: Every time an Ajax call is made, JavaScript replaces the URL with a URL that is exactly the same, except for some variables that I am passing. The variables are ONLY passed to the RIGHT a #, which will not reload the browser. If you change anything to the left of the #, it will reload the whole page, which you obviously don't want. This is how that particular Ajax state can be "saved" to the URL. Then, each time this is changed by your JS function, you'll want to save that URL in a JS variable for use later. The second part of this is to then retrieve the URL state. You'll probably want to do this in two ways. The first way will be when the page loads. That way, if someone bookmarks the page with a # and a bunch of variables, they will get the desired page when they access that bookmark. The second way would be a JavaScript setInterval or setTimeout loop that periodically checks to see if the URL is different than the URL you previously saved in the JS variable from the first step. If it is different, that means the user either clicked the browser's back button, or they accessed that bookmark. I've found that a setInterval/setTimeout time of one second is the best compromise between there not being too much delay and also having very little effect on the user's CPU usage. Here's a brief example of the JS to replace the URL: top.location = "index.php#variableOne=something&variableTwo=somethingElse"; previousURL = top.location; Here's a function to extract those variables: function getURLString(){ var href = window.location.href; var position = href.indexOf('#'); if (position==-1){ position = href.indexOf('?'); } if (position>0){ position++; return href.slice(position); } else{ return ""; } } Then parse them out, separating them out with the & character, then extracting the variable name and value with =. Finally, the function that looks for updates: function checkForURLUpdates(){ var currentLocation = window.location.href; if (previousURL != currentLocation){ // do stuff } setTimeout("checkForFeatureActionUpdates()",1000); } Hope this at least gives you ideas.
  9. Yeah, if I were you I would write a few JS functions with PHP, populating the country, city, and neighborhood lists. Then have an onchange event on the country that populates the city, and one on the cities that populates the neighborhood.
  10. Well, you posted in the right place. Since you're already using jQuery, just use their Ajax module to load the data into the div, then in the call back function, call the show() function.
  11. Using Ajax would give you the most flexibility and would be best if you plan on pulling this data from a database, but if you will only ever have those two cities with those neighborhoods, just do it in JavaScript. Another option would be to write your JavaScript with PHP when the page initially loads. Here's a JS tutorial on adding and removing options from selects: http://www.javascriptkit.com/jsref/select.shtml
  12. Where's the rest of your code? Do you actually have a div with an ID of "onSiteDiv"?
  13. Try changing your input "submit" to type "button". Maybe you're actually submitting the page as well.
  14. Where's the rest of your code? Show the HTML with the form and the submit button.
  15. $("#changePass").click(function() { document.getElementById('changePass').disabled = true; document.getElementById('changePass').value = 'Loading...'; $.ajax({ type: "POST", url: "modules/forgotPassword/changePassword.php", data: {pass: $("#newPass").val(), confirmPass: $("#confirmPass").val(), email: $("#changePassEmail").val()}, cache: false, success: function(html){ $("#changePassMessage").prepend(html); $("#changePassMessage").slideDown("slow"); document.getElementById('content').value=''; document.getElementById('content').focus(); $("#changePassLoading").hide(); document.getElementById('changePass').disabled = false; document.getElementById('changePass').value = 'Submit'; } }); return false; });
×
×
  • 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.