Jump to content
Larry Ullman's Book Forums

Antonio Conte

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Antonio Conte

  1. Read the content. It says that only PDFs smaller than 5MB are accepted. Change the code or make adjustments according to values in the code that makes sense. If that doesn't work, you'll have to alter som PHP settings.
  2. I work with EZ Publish which requires a lot of memory sometimes during installation due to legacy reasons. Therefor I had to do the same recently. Also, due to a recent composer bug, 1 GB of memory was required to update all dependencies on one of our projects. Crazy. Glad I could help. I agree with Larry that you should maybe look at solving the problem differently. Throwing memory on problems can help out, but it might not be suitable in the feature. Whatever works, I guess.
  3. You need to do an equality check when you output each option, and add 'selected="selected" to the element. The "tricky" part here is that you allow multiple values, so Skills[] (which you could consider naming for easier reference) could contain between zero to N values. You'll therefor need to loop that array, or write a function that helps you with that. Something along the lines of: $driverSkills = $_POST['Skills'][]; // Use key or index to fetch actual driving skills here. function isSelected( $array, $value ) { foreach ( $array as $option ) { if ( $option == $value ) return true; } return false; } <option value="Traffic Planner" <? if ( isSelected("Traffic Planner") ? 'selected="selected"' : ''; ?>>Traffic Planner</option> The approach is a little naive, but will work. To optimize it, you should consider moving from String values to integers on the option elements. That way, you could be able to both output and check the content in the same operation: $drivingSkills = array( 1 => "LGV Class 1", 2 => "LGV Class 2" ); $selectedSkills = $_POST['skills']['driving']; // Named keys are simpler <select name="skills['driving']" multiple size="1" id="Combobox1"> <?php foreach ( $drivingSkills as $value => $name ) : ?> <?php if ( isset($selectedSkills[$value]) : ?> <option value="<?= $value ?>" selected="selected"><?= $name ?></option> <?php else; ?> <option value="<?= $value ?>"><?= $name ?></option> <?php endif; ?> <?php endforeach; ?> </select> You'll need some more safe-guarding like creating an empty array if $_POST['skills'] is unavailable, but that's all to it.
  4. You need to alter the PHP configuration. The problem is that the script takes too much memory, and therefor gives you a fatal error. You can get your current limit by: php -i | grep memory Change it by: a.) Alter the php.ini configuration file. Up the declaration "memory limit" (and make sure it's uncommended.) b.) Or adjust it in a single script adding ini_set('memory_limit', '64M'); to the top your script. You can also use a flag to do this from the command line, but I don't remember that at the moment. I would recommend just changing php.ini.
  5. This is Bootstrap. You can mix and match everything you find in the docs right out of the box. No problem. The main part is understanding the grid system. If you make sure your markup matches it, you'll have no problem using anything.
  6. Refactor out the functionality you need in a new function, and take the HTML element to change as an argument: function something(element) { var element = $(element); // do stuff } something("#fader"); something("#other");
  7. You have a typo where you foreach your errors. Instead of foreaching $errors, you foreach $error in your code. The loop will thus not run, and no errors will be displayed.
  8. Type php -i in the command line should give you the path. Just make sure you reference the php version used to serve php files, as it can possibly differ from the default one in your command line.
  9. Not totally true. Department\Class and Employee\Class is then working namespaces. You don't NEED to specify the full namespace.
  10. How do you think instanceof should work? You are checking if $TEST is an instance of Config - which it is. You might be thinking wrong here.
  11. You don't actually NEED traits to debug classes. My favorite debugging technique is to put objects or arrays into this: echo '<pre>' , print_r($object, true) , '</pre>'; It should give you object names and display the object internals. If you want object methods, foreach get_class_methods(). If you want the same functionallity inside your objects methods (for whatever reason) simply create methods that call those functions Larry applies with $this as a parameter.
  12. Upgrade you dev environment. Much simpler than doing anything else. If that is not possible for any reason (you depend on 5.3 for other reasons, etc), reasearch how to work with multiple PHP versions on your system.
  13. Double check your username and password. As simple as that. It's often 'root' (username) and '' (no password) for the standard XAMPP setup. If it's not obvious, you need to change the info in mysql(i)_connect() to match your own DB user credentials.
  14. The conversion is not permanent. You need to apply the same function every time you SELECT the timestamp. Also, it looks like you mix up SELECT statements with INSERT statements here. The general "rule" is: 1. Save all time data in a unified timestamp. (UTC+0) 2. Apply conversion only when you display date info. By doing this, you can also apply user selected time zones, etc, so times can be correct for everyone.
  15. 1) Add the PEAR directory to your include_path by altering php.ini. Google it. or... 2) Go modern, and look up working with Composer instead of Pear. It's the future. Find HTML Quickform on Packagist.com once you've installed composer.
  16. Did you try my LEFT OUTER JOIN suggestion? This doesn't make sense if you have done everything right, so I'm thinking the error here is as basic as a misspelling or similar. Look closely at the actual tables to make sure they are actually there (dev-vs-prod environment might be different) and that you haven't called it 'genres' or 'genereName' instead of genre.
  17. No worries. Jon is a JavaScript wizard, FrontEndDev, so listen to him if you want to live up to your name.
  18. setText is a helper function created to set input on an element. It wraps the if statements for checking if textContent exists ( that's the logic in: textContent !== undefined ) or if you need to use the function innerText. It's basically a short-cut method of choosing the setting method that exists in your browser. (as one of them might not exist) You send in the element ID (<input id="name"> would equal ID = name) and the value to set it to. setText('name', 'Thomas'); would therefor set the input field to 'Thomas' by the best method possible supported by the browser. var output; is actually the object from the input field with the ID of 'name' in my example. You save it to a variable so you don't have to look for the object each time with a call using document.getElementById(). It's a performance gain. document.getElementById is a native JavaScript function, so you can't 'find it' in your code. The object saved to the variable output actually IS the HTML. More precisely, it's a node in the document model that makes up a HTML page. Because the variable contains that node (think of it as the input field itself) with functions to alter itself, we simple update the input field by using output.textContent or output.innerText. Those are functions for changing the internal data in the field, and it will be updated visually for the viewer. Hope that makes the pieces click.
  19. SELECT movies.movie_id, movies.movie_title, movies.movie_desc, studio, scene_name, genre FROM movies INNER JOIN studios ON ( movies.studio_id = studios.studio_id ) INNER JOIN scenes ON ( movies.movie_id = scenes.movie_id ) INNER JOIN movie_genres AS genres ON ( movies.movie_id = genres.movie_id ) INNER JOIN movie_actors AS actors ON ( movies.movie_id = actors.movie_id ) ORDER BY movie_id ASC, scene_name ASC Structure your queries more to spot errors. SQL is a lot easier to read when you do that. The error message is very revealing here. Make sure the column is actually called 'genre'. If that doesn't work, make sure you actually have a match for the movie_id in the movie_genres table. As a simple test, try switching the 'INNER JOIN ...' to 'LEFT OUTER JOIN ...' and see if you get a null value in the genre column. Hope you solve it.
  20. The actual code and error message would make helping you a lot easier.
  21. Interesting problem. I've followed this one from the sideline. My programming teacher always said logical bugs are the hardest to debug, and I would have to agree. I was really interested in seeing whether there was a bug in mysqli_real_escape_string or not.
  22. What you need is a parsing system. A common format is BBCode, the system also used on this forum. It removes the security issues related to allowing HTML in text, while allowing styled text. You should be able to google it for more information.
  23. It's absolutely a good idea, though. I use the same, pretty strong, password on every site I don't care about, but a password handler would be beneficial. I think I might just download passwordBox to check it out. I just hate the thought of having to do the extra work of using something like this.
  • Create New...