Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. Not as far as I know, but using the ID and getElementById would be a preferred/more proper way of doing it anyway. Calling .submit() does not cause the onsubmit event to be executed. You have to run that code manually prior to calling the .submit function.
  2. Solve what? You just said it works fine. If your talking about what shows in the post data, there is nothing to fix. It is showing you the contents of the post variable that contains your file upload. The contents of that variable is the file data you're uploading (in this case a PNG image). So how to solve it? Stop looking at firebug.
  3. You don't need to escape the $'s with a slash like you're trying to do. The only time you would need to is if you're writing a string literal using double-quotes (to prevent PHP from thinking they are varaibles). If you use single-quotes or pull the value from somewhere (database, cookie, variable, file, etc) then you do not need to do anything to it.
  4. http://viper-7.com/ULawLf Working sample.
  5. The way you are doing things right now, you're replacing your bb elements with a string of PHP code. That PHP code never actually executes during the page load so you'll just see it in the page's view source as is. If you want that code to be executed then you need to run the code and replace the bb element with the results of it running, not with a string of PHP code. So you'd run your elementCreate($1) function and replace [element=menu] with what it returns. Something like: function bbElement($transform){ $a = array( "/\[element=\"(.*?)\"\]/ise", ); $b = array( "elementCreate(\"$1\");", ); $transform = preg_replace($a, $b, $transform); return $transform; }
  6. I vote we make them roman numerals.
  7. You argument order for mysqli_connect is wrong. If you check the manual page for mysqli_connect, you'll see it is defined as follows (spacing added for clarity) If you check your call to the function, you have (again, spacing added for clarity): new mysqli( $host , $port , $socket , $user , $pw , $dbname ); As you can clearly see, you have the port where the username should be, the socket where the password should be, etc. You need to re-order the arguments so they match the signature. On an additional note, unless you actually need to specify different port or socket, which based on the code you don't, you should just leave those parameters out and let them be the defaults.
  8. The (13) is the system error code for why exactly it cannot connect. If you lookup that error using the perror utility you get: As such, you need to check your permissions again. The user your server is running as does not have the proper access rights to open that file.
  9. When you submit a form, the browser will only submit the elements that are contained within the <form> tag. As for determining which form it was that was submitted on the PHP end of things, you need some element that you can check which differs between the forms.
  10. Join your $block_include array together into a string using implode prior to the replace.
  11. The yellow background is something that the google toolbar will do in other browsers like firefox. In chrome itself (on windows at least) it does not do the yellow background thing unless you start typing then hover over an auto-complete entry in the popup of options. Linux may be different, I don't know. In any case, it's a problem with your setup, and not anything you're going to fix via code really (aside from disabling autocomplete like you did).
  12. Works fine for me. Looks like: Disable all your browser addons, maybe something is overriding it for you.
  13. http://jsfiddle.net/6JC3E/ Works just fine in chrome.
  14. It sounds like your issue is not with the re-write stuff, but with your HTML. You need to change how you reference your images so that they will work with the new URL style. For example if you're old url was http://www.peten.co.uk/clientarea/ford/?page=new-car and you're image take is like so: <img src="../../images/blah.jpg"> Then it will be searching for the image at http://www.peten.co.uk/images/blah.jpg. Once you implement you're rewrite rules and the page's URL becomes http://www.peten.co.uk/clientarea/ford/new-car/vehicle/ford-ka, that same image tag is going to be looking for the image at http://www.peten.co.uk/clientarea/ford/images/blah.jpg What you need to do is update the image URL's so they are correct using the new format. The easiest way to manage that would be to use an absolute url or a relative-to-root path, eg: <img src="http://www.peten.co.uk/images/blah.jpg"> or <img src="/images/blah.jpg">
  15. Assuming you have a parent-child relationship going in your database at the moment, you could select all the data and build a tree out of it using some references and a loop. It's not the most efficient method but should be fine for anything less than a thousand entries or so. The big thing to avoid is doing queries within your loop. By selecting everything in a single query you save time gathering data and just focus on processing it. This article describes how to build the tree out of the list. http://jacobsantos.com/2009/general/dynamic-tree-building-in-php/ A better solution, if you're able to re-structure the database would be to set it up as a nested set system, which is described in this article: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ With the nested set system finding all of the parent's of a particular item is a simple SELECT query.
  16. set the option CURLOPT_FOLLOWLOCATION to true.
  17. $stats['members'] = $totalmembers; $groupinfo[] = $stats; wanting to "add [$totalmembers] below each g_color" means you want to add it to the stats array, since that is where g_color exists at.
  18. foreach does odd things with the internal array pointer. As such you shouldn't really mess with it when your looping your array. Either put your strings in their own array and implode() it or use trim() to remove the last comma. To be somewhat more precise about what happens to the pointer, foreach() resets the pointer to the beginning of the array before it executes, and at some point the pointer gets advanced once more prior to running your first iteration of the loop. So on your first iteration the pointer is at element [1] which means if you call next() each iteration you're going to hit the end of the array in your second to last iteration, not the last one. Note this behavior of what foreach() does with the pointer is not something that you should rely upon. If PHP ever updates how it processes a foreach() the behavior may change.
  19. .is() returns true or false based on whether the elements match the given selector. If any of the images you selected are visible it will return true, if they are all hidden it will return false. That false is what you need to check for, not a non-existant .length property. if (!$('#image1, #image2, #image3, #image4').is(':visible')) { alert('I am a bunny'); }
  20. I would guess that .is(':hidden') is not true until the hide animation is complete. What you would need to do is run a function after the animation ends (using it's callback parameter) that will run your :hidden tests.
  21. There is no connecting with Mysqli, mysqli is just a different access layer within PHP. When it comes to talking with mysql pdo, mysqli, and mysql all use the same fundamental mysql library. The difference is the API that is exposed to PHP and what they allow you to do. On that level, PDO and Mysqli are more or less equivalent. You can extend PDO if you want, just like you can extend any other class. I do in order to provide a bit nicer debugging features and set some initial settings. You would still be connecting the same way though.
  22. The server only knows if a user is active or not by receiving requests from them. Even if someone is actively doing something on your page (typing a bunch, playing some game, reading whatever) if there are no requests being sent to the server they are going to be considered inactive. The setting that controls how old a session has to be before it can be deleted is session.gc_maxlifetime. You can set this in your php.ini file or using ini_set prior to calling session_start().
  23. define: namespaces define: assembly
  24. Why not just move whatever content is on the desktop PC onto this server? They you don't have to try and come up with some weird solution to turn the PC on upon request. A WoL packet has to be sent on the local LAN, which means you can't send it from a host on a different network. You're going to have to have at least one device somewhere on the lan online 24/7 in order to send the packet from, and a way to tell that device to send said packet.
  25. Yes, and it gives you back an array which you could then pass into array_count_values. $values = explode(',', $_SESSION['cart']); $count = array_count_values($values); print_r($count);
×
×
  • 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.