Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

Everything posted by F1Fan

  1. Yes, that's basically what I said. Run a select to get the data, then loop through all the results and do an update for each row accordingly. But I don't suggest you do this. It will take significantly longer than just doing it in SQL. Why would you want to use PHP rather than SQL?
  2. Here's a fairly simple pagination class file that I use all the time. It's simple, but it still gives you a page list, next page, previous page, etc., all from just an array, per page number, and current page number. [attachment deleted by admin]
  3. Well, you could do it with PHP, but it would be significantly more complicated and slower. The reason for this is that you would have to extract the database data first, then run the update query. Plus, you would have to run as many update queries as there were rows. For instance, if you had 1,000 rows, you would have 1,001 queries; one select query to get the data and 1,000 update queries to update the rows. With your original solution, just one query is required, regardless of how many rows there are.
  4. I think that's correct, but that is completely dependent on your SQL type. You'd have better luck posting in the appropriate SQL board, not in the generic PHP board, especially since this is only a SQL question.
  5. Sounds like you aren't getting any results from your query.
  6. You're right on both accounts. Since PHP is a server-side language, to do it only in PHP would mean doing it from your server. Therefore, you need client-side scripting, or JavaScript. Try something like this: <body onload="document.forms[0].submit();"> <form method="post" target="iframePost" action="http://theotherserver.com/somescript.php"> <input type="hidden" name="variable1" value="3"> <input type="hidden" name="variable2" value="fred"> <iframe style="height:0px;width:0px;" name="iframePost" src=""></iframe> </form> </body>
  7. Now that I think even more about it, you're actually going to need to use JS in the iframe page that resizes the iframe window. window.parent.document.getElementById('new').style.height = some number; Something like that.
  8. No. The problem is that the overflow-y: scroll is already how it will behave. The problem is not with the body, it is with the iframe. Assigning height to 100% sets its height to 100% of the window height, not the web page's height, which is why it's not working. I don't think there's anyway you'll be able to do it without assigning the height in pixels manually, either with JS or with CSS.
  9. Not Java, JavaScript. Completely different. And I don't believe you can do it without JS. Is there any other element in the page that will be the height that you want the iframe to be? If so, add an ID to it and try this: document.getElementById('new').style.height = document.getElementById('otherID').offsetHeight;
  10. Ah, yeah, that won't work. Do you know how tall the page in the iframe will be? If so, you can assign it a height of that many pixels. Try this. Use JavaScript to get the height of the body element and assign it to the iframe. document.getElementById('iframeID').style.height = document.body[0].offsetHeight; You'll need to either put that at the end of the page, or in a function that is called with the onload event AND on the onresize event. Also, you'll need to assign the ID to the iframe.
  11. I believe you can assign its height to 100%. style="height:100%;"
  12. You can also use Firebug to put breaks in the JS. From there you can view set variables and resume JS operation.
  13. I'm sorry, but I'm not sure at this point. I use Firefox to code in, and I've found the Firebug add-on to be incredibly handy. I don't know anything about the Chrome log window in the JS console, but I can tell you that Firebug will allow you to watch the AJAX calls as they happen, and view the response, as well as other things. You may want to try that.
  14. Actually, it just occurred to me that on an AJAX call, any JS error will appear on the line where the AJAX was called. So, maybe your problem is in the xml_maker.php file.
  15. Here's a function that finds all the elements with a certain class name. You should be able to easily modify it to just get every element. function getElementsByClassName(classname, node) { if (!node){ node = document.getElementsByTagName("body")[0]; } var a = []; var re = new RegExp('\\b' + classname + '\\b'); var els = node.getElementsByTagName("*"); for (var i=0,j=els.length; i<j; i++){ if(re.test(els[i].className)){ a.push(els[i]); } } return a; }
  16. Well, just to verify it, view the page source. In Firefox or Chrome the file references, such as your "./../classes/rico21/src/rico.js" will be clickable links. Click on that link and that will confirm that you are, in fact, pointing to the correct location.
  17. It appears that the Rico object isn't being set. Do you have this in your code? <script src="rico.js" type="text/javascript"></script> If you do, is it included before or after your function is called? Are you sure you are pointing to rico.js properly?
  18. Interesting. A colleague and I attempted to create a simple test page to replicate the error, and try as we might, we could not get it to occur without the AJAX component. It must have something to do with the placement, although we tried moving the element and the JavaScript to various parts of the page and still couldn't get it to happen again. But, obviously we hadn't tried every possibility. In any case, I'll be sure to keep my element IDs different from my function names, etc. Thanks for the reply.
  19. Uhg. I just figured it out. Thanks Mchl for your reply. If anyone is interested, I had an element ID with the same name as the function that wasn't working. I did NOT have a variable name the same, it is a string. This still baffles me why this caused this error, but I changed the element ID to something different and it now works. My only guess is that it has something to do with AJAX. When the page loads, I have an AJAX function populate a lot of fields. While that's happening, I am disabling the button with the same ID as the name of the function, and re-enabling it under certain conditions. The response from the AJAX is PHP-generated JS code that is then evaluated with the JS eval() function. So, I can only assume that the eval() may be creating that string into a variable, or some other JS element that is not a function, thus throwing the error.
  20. My main question is what are all the things that could go wrong to cause an error like "whatever is not a function"? I will simplify this significantly. I have a PHP page that includes a JS file, PHP line 68: <script type='text/javascript' language="JavaScript" src="javascript.js?<?php echo time(); ?>"></script> On PHP lines 216 and 218 I have buttons that call two different functions that are in that JS file: <input type="button" value="Run Function One" onclick="functionOne();"> <input type="button" value="Run Function Two" onclick="functionTwo();"> Viewing the source in Firefox, I can click on the JS file to view it, and it shows both functions, BUT functionOne() works perfectly, but functionTwo() throws the "functionTwo is not a function" error. Obviously the JS file is being properly included, because functionOne() is working, and it's not being cached because I'm passing the PHP time variable. And I am sure that there are no typos in the function name or anything else like that. Another odd thing is that the function that it cannot find is between two functions that it CAN find! I'm baffled. So what else could it possibly be? I know sometimes syntax errors can cause this, but in my experience, those syntax errors corrupt the whole JS file, not allowing any of its functions to work. Ideas?
  21. So what is calling that last bit of code? Is it in a function or what? If it is not in a function, then it will run before the variables ever get set by the Ajax call. If it is in a function, what is calling that function? If that function is called before the Ajax script completes, they won't be set.
  22. Hmm, then I'm not sure. Post the rest of your relevant code, maybe that'll help.
  23. You need to initialize the variables in the global scope. Then, the request can modify them, allowing the modified versions to be available globally.
  24. I was just gonna say that. Glad you got it working.
  25. Well, I've never tried the overflow on a <td> element, so maybe that's the problem. OK, try this: put a <div> inside the <td> and add that style to the div, and put your content into the div.
×
×
  • 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.