Jump to content

ialsoagree

Members
  • Posts

    406
  • Joined

  • Last visited

About ialsoagree

  • Birthday 12/17/1985

Profile Information

  • Gender
    Male
  • Location
    New York

ialsoagree's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry, I forgot my "i" above for mysqli_fetch_assoc! $query = "SELECT u.profile_image FROM users AS u WHERE student_id = $current_student_profile_id"; $result_array = mysqli_fetch_assoc(msyqli_query($link_id, $query)); // You'll have to define $link_id yourself $actual_image_name = $result_array['profile_image'];
  2. $query = "SELECT u.profile_image FROM users AS u WHERE student_id = $current_student_profile_id"; $result_array = mysql_fetch_assoc(msyqli_query($link_id, $query)); // You'll have to define $link_id yourself $actual_image_name = $result_array['profile_image'];
  3. Sorry, perhaps I should have been more specific. Where is "$actual_image_name" being defined in "student_home.php"?
  4. Where is "$actual_image_name" being defined?
  5. The problem is here: document.changepassword.response.value = \"Match\"; Check out getElementById(): http://www.javascript-coder.com/javascript-form/getelementbyid-form.phtml or other methods to access the HTML DOM in javascript: http://www.quirksmode.org/dom/intro.html
  6. .josh, I mostly agree with your sentiments. I strongly agree the hybrid approach is best. My statement about preloading was really just to counter that the split second lack of style is some how a bigger inconvenience than reloading the entire page. Without it, you only have the overhead of writing the javascript along with the rest of the page on each page load. To me, that's a worthwhile thing to program for user friendliness, but that's certainly up to everyone's own opinion.
  7. I don't disagree, you obviously don't understand what the OP was asking. Allow me to explain the problem, and why javascript IS the correct solution: You have a webpage that lets the user change the way the page is displayed. There are buttons to make that change. Is it better to: A) Form a new HTTP request, have PHP requery the database, perform all it's if/thens, write a new page, and then send that to the browser. B) Have javascript update the page, and save the change to a cookie. If you don't choose B, you are doing it inefficiently. Sorry, but it's you who are doing a "hack" solution. Then your opinion and mine vary GREATLY. I cannot, under any circumstances, imagine a scenario in which it's better to create 2 HTTP requests for something that only needs 1, query the database twice for a situation that only needs 1 query, and create 2 history files in a browser (1 correct, 1 wrong) for a task that only needs 1. Mean while, my solution has no down side. Because, as I pointed out, you can still load the correct page using PHP on the first try. You are welcome to disagree with me, but please don't tell me javascript is not used to change front end content, or that using it to do so is a "hack" solution. If that's what you think, you need to learn more about javascript.
  8. Sure, except the browser has a cache, therefor defeating the need to "preload" a CSS file you've already loaded. Actually, that's entirely besides the point. Why can't your PHP file check for a cookie on it's own? Even if you do that, it's still faster to have the switch of the CSS file done by javascript. At this point, you're just nit picking, and you're not even doing a good job of it. Edit 2: Actually, now that I think about it, you could even have Javascript choose which file to load by first checking the cookie, and if there is none, loading the default. There's really a lot of solutions to this "problem."
  9. Actually no, the *very* first link talks about loading a css file: http://stackoverflow.com/questions/6806849/preload-javascript-and-css-files
  10. Seriously? Are you kidding me? http://lmgtfy.com?q=javascript preload a file
  11. Just like PHP would, yes. In fact, javascript can make that change arguably faster than PHP can once the file is cached (and it will be cached once you load it for the first time, which if that involves a switch, will favor javascript by a second or more depending on how long it would take the server to process the request using PHP).
  12. Do you mean, if there's no cookie at all? The same way PHP would: by having a default. Do you mean, how will javascript know? http://www.quirksmode.org/js/cookies.html
  13. I've already pointed out why this is wrong: Please <mod censor>. PHP is the over complication. You're trying to do a server-side change of front end content that javascript is entirely able to handle itself. By the way, if cookies are disabled, unless there's a login feature or the OP wants to save the selection via IP, there's no way to save the selection anyway.
  14. Neither. When the user makes a selection: update the HTML/CSS and save that selection in a cookie using javascript. If the user changes pages, reloads, whatever, it's saved in the cookie, you're all set. If the user wants to change back, simply update the HTML/CSS again, and save the selection in a cookie using javascript. You can do this as much as you want, no page loads, no queries to the database, no http requests (unless it has to load a css file). This is the most efficient way to solve this particular problem, it is why javascript exists.
×
×
  • 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.