
lonewolf217
Members-
Posts
642 -
Joined
-
Last visited
Never
Everything posted by lonewolf217
-
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
-
How to restrict access to html pages?
lonewolf217 replied to UrbanDweller's topic in Javascript Help
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. -
How to restrict access to html pages?
lonewolf217 replied to UrbanDweller's topic in Javascript Help
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 -
copy/paste glitch i think
-
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); <----------------------------- ?>
-
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
-
Small peice of PHP code with big problems
lonewolf217 replied to JudgementDay's topic in PHP Coding Help
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. -
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> });
-
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.
-
Help converting seconds to minutes and hours
lonewolf217 replied to edd12345678's topic in Javascript Help
you can easily modify the math to show whatever you want -
First iteration of foreach much slower than rest
lonewolf217 replied to lonewolf217's topic in PHP Coding Help
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. -
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."')"); ?>
-
First iteration of foreach much slower than rest
lonewolf217 replied to lonewolf217's topic in PHP Coding Help
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. -
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.
-
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)
-
First iteration of foreach much slower than rest
lonewolf217 replied to lonewolf217's topic in PHP Coding Help
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. -
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
-
send multiple e-mail messages using MySql database
lonewolf217 replied to HalRau's topic in PHP Coding Help
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 ? -
dont need the whole thing, just post the relevant lines
-
what is the code for including the file
-
<?php $row = mysql_fetch_array($result); $page_id = $row['page_id']; ?>
-
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
-
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