Jump to content

lonewolf217

Members
  • Posts

    642
  • Joined

  • Last visited

    Never

Everything posted by lonewolf217

  1. i code in notepad++ not dreamweaver so unsure. does dreamweaver even support jquery ? post the whole section of code here, maybe there is another syntax error somewhere
  2. that is why javascript validation is a "nice to do" feature but you must always revalidate in the backend to make sure the data is correct.
  3. javascript is the wrong way to do this since they can just disable javascript in the browser. use php or even better would be filesystem/webserver level security to restrict access
  4. because you already retrieved the first record here <?php $results = mysql_query($query) or die("Query failed ($query) - " . mysql_error()); $row_a = mysql_fetch_assoc($results); <----------------------------- ?>
  5. yea sorry you need to include the jquery source files and then wrap this into the script headers. you can find the details at jquery.com
  6. You are using the same object for the loop iteration as you are the counter so your $data object is reset each time during the loop. Use a different object for your counter and you should be fine, and make sure you initialize it to zero.
  7. with a class you no longer need the onclick, you would just have jquery something like this $(document).ready({ $(".dropdown").change(function() { var total = 0; $(".dropdown").each(s,function() { total += s.val(); }); $("#total").innerHTML("The Total is " + total); }); <body> <span id="total"></span> </body> });
  8. if i understand correctly you just need to sum the vals from multiple dropdowns, so assign an ID to each dropdown then you can do something like this (excuse little syntax errors) <select name='drop1' id='drop1' onChange='sumSelect()';> </select> <select name='drop2' id='drop2' onChange='sumSelect()';> </select <select name='drop3' id='drop3' onChange='sumSelect()';> </select> <span id="total"></span> <script type="text/javascript"> function sumSelect() { var total = document.getElementById("drop1").val() + document.getElementById("drop2").val() + document.getElementById("drop3").val(); document.getElementById("total").innerHTML(total); } </script> of course you can optimize it by looping through all of your select statements depending on your naming convention, something like jquery could really speed it up if they have all the same class for example.
  9. you can easily modify the math to show whatever you want
  10. check all of your braces, i think you are missing a couple of closes for For and Ifs in the "case 'restorelocalnow':" section
  11. unfortunately wmi calls seem to return variant objects which are a pain in the ass to work with. so i guess there is nothing i can do about it.
  12. the problem is that obviously it was not expecting it, so you would either have to post the entire switch statement or look for syntax errors within the statement. perhaps you didn't close a brace or something so it wasn't expecting the next case statement yet.
  13. since we dont know where your inputs are coming from, simplest way to check is to do this <?php echo "INSERT INTO users (name, group, sex, grouprank) VALUES ('$name', '$group', '$sex', '$grouprank')"; ?> throw the query into SQL manually to see what the error is. One possibility is that SQL doesn't like variable names. you can try one of these two options to see if it helps (I dont know the reasoning behind it, but i read it somewhere once before ) <?php $insert = mysql_query("INSERT INTO users (name, group, sex, grouprank) VALUES ('{$name}', '{$group}', '{$sex}', '{$grouprank}')"); $insert = mysql_query("INSERT INTO users (name, group, sex, grouprank) VALUES ('".$name."', '".$group."', '".$sex."', '".$grouprank."')"); ?>
  14. Not one of the ones i saw before but still an interesting read. I did try to use this <?php $x = &$resultDisk; ForEach($x as $itemDisk) { ?> but it didn't seem to improve the speed at all. I will give your article a closer looksee to make sure i didn't miss anything.
  15. the point is your form isn't even getting validated because you have too many syntax errors. you have to fix your syntax errors before you can check functionality.
  16. well, you didn't say what the error was, but by running it through an online validator tool like http://www.piliapp.com/php-syntax-check/ returns many errors including missing parenthesis for if statements and malformed if/else blocks (else if after an else)
  17. i have read similar online, i just cannot understand why this wmi class takes so much longer than some of the others i am querying. Oh well, ill see if there is another way to improve it or try the same thing in vbscript to accomplish what i need.
  18. if(!isset($_SESSION)) { session_start(); } i think that will do it. you would have to hande the session unregister on logout though or have some sort of session timeout probably
  19. what do you mean when you say "it also sends a mail for cc and bcc" ? Every message always has cc and bcc fields even if you do not populate them with anything. Are additional mails being sent in this case ?
  20. dont need the whole thing, just post the relevant lines
  21. what is the code for including the file
  22. <?php $row = mysql_fetch_array($result); $page_id = $row['page_id']; ?>
  23. Specific question with general application here. i am having some trouble with a loop and am getting some odd timing results specifically this is a WMI query on a hyper-v server retrieving disk information but im not sure the context of the query is relevant here. The main question is how come the first iteration of the loop is so much slower than the other iterations, it just doesnt seem to make sense to me unless ive done something stupid here i cannot see. any ideas ? <?php $diskstart = microtime(true); // get the hard disk size try { $resultDisk = $wmi->ExecQuery("SELECT BlockSize,NumberOfBlocks FROM msvm_LogicalDisk where systemname like '%" . $guid . "%' and name='Hard Disk Image'"); $ct=0; $start1 = microtime(true); $start = microtime(true); foreach($resultDisk as $itemDisk) { $end = microtime(true); echo "<BR>FOREACH: [" . Round($end-$start,3) . "] seconds"; $vm[$name]['disks'][$ct] = ($itemDisk->BlockSize * $itemDisk->NumberOfBlocks)/1024; // format the disk size into KB $ct++; $start = microtime(true); } $end1 = microtime(true); echo "<br> ALLLOOP: [" . Round($end1-$start1,3) . "] "; } catch(exception $e) { } $diskend = microtime(true); echo "<br>DISK: [" . ($diskend-$diskstart) . "] seconds"; ?> and here are the results FOREACH: [1.236] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds FOREACH: [0.002] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds FOREACH: [0.001] seconds ALLLOOP: [2] DISK: [2.1837468147278] seconds
  24. you always have to push the results of the query into an array of some sort before you can read the data, whether is 1 row or 1 million rows
×
×
  • 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.